The code written in the forum is mainly to demonstrate the usage of the main functions to be introduced. There may be a better or direct way to implement it.
The following code mainly introduces the AcGe geometry library function and uses the MPOLYGON object to Intersect the HATCH,MPOLYGON,REGION,,Closed Curves(circle,ellipse,*polyline,spline...) entities.(any combination);|Can be between HATCH, REGION, MPOLYGON (any combination)|;
(defun c:XDTB
-IntSect
(/ e1 e2
) ;| Use the AcGe geometry library to determine whether it intersects|;
(defun _hasInterPnts
(e1 e2
/ g1 g2 intv ret
) (and (setq g1
(xdrx
-getpropertyvalue e1
"rootloopat" 0)) (setq g2
(xdrx
-getpropertyvalue e2
"rootloopat" 0)) (setq intv
(xdge::getpropertyvalue g1
"getinterval" g2
)) )
)
(xdrx-object-release g1 g2 intv)
ret
)
(setq e1
(car (xdrx
-entsel "\nSelect main color block<Exit>:"'
((0 .
"HATCH,REGION,MPOLYGON"))))) (setq e2
(car (xdrx
-entsel "\nSelect the color blocks to be InterSect<Exit>:" '
((0 .
"HATCH,REGION,MPOLYGON"))))) )
(xdrx-begin)
(if (_hasInterPnts e1 e2
) (xdrx-get-intersect e1 e2)
(xdrx
-prompt "\nTwo color blocks were successfully InterSect.") )
)
(xdrx-end)
)
)
)