The API provides three powerful topology functions, intersection, union, and difference, which can implement intersection, union, and difference operations between any two entities such as Curves, Hatchs, Regions, and MPOLYGON.
![](http://www.theswamp.org/index.php?action=dlattach;topic=58786.0;attach=41610;image)
The type of the resulting entity depends on the first entity, if the first one is a curve, the result is a curve, if the first one is a HATCH, the result is a HATCH....
(xdrx-get-intersect e1 e2)
(xdrx-get-union e1 e2)
(xdrx-get-subtract e1 e2)
;
;union
(xdrx_entsel
"\nPick Curve, Region, Hatch MPOLYGON<Exit>:"
'((0 . "*line,arc,circle,ellipse,hatch,region,mpolygon"))
)
)
)
(xdrx_entsel
"\nPick Curve, Region, Hatch, MPOLYGON<Exit>:"
'((0 . "*line,arc,circle,ellipse,hatch,region,mpolygon"))
)
)
)
)
(progn (xdrx
-get
-union e1 e2
)) )
)
;subtract
(xdrx_entsel
"\nPick Curve, Region, Hatch, MPOLYGON<Exit>:"
'((0 . "*line,arc,circle,ellipse,hatch,region,mpolygon"))
)
)
)
(xdrx_entsel
"\nPick Curve, Region, Hatch, MPOLYGON<Exit>:"
'((0 . "*line,arc,circle,ellipse,hatch,region,mpolygon"))
)
)
)
)
(progn (xdrx
-get
-subtract e1 e2
)) )
)
;Intersect
(xdrx_entsel
"\nPick Curve, Region, Hatch, MPOLYGON<Exit>:"
'((0 . "*line,arc,circle,ellipse,hatch,region,mpolygon"))
)
)
)
(xdrx_entsel
"\nPick Curve, Region, Hatch, MPOLYGON<Exit>:"
'((0 . "*line,arc,circle,ellipse,hatch,region,mpolygon"))
)
)
)
)
(progn (xdrx
-get
-intersect e1 e2
)) )
)