
The following code demonstrates the process of using the XDRX API to obtain the boundary LOOP topological relationship of the filled entity.
1. Pick up and HATCH
2. Pick a test point near a boundary
3. The boundary entity is displayed in magenta, and all LOOPs inside the boundary are displayed in yellow.
(if (and (setq e
(xdrx_entsel
"\nPick a HATCH<exit>:" '
((0 .
"HATCH")))) (xdrx_pickset_redraw e)
(setq p
(getpoint "\nClick a little near the HATCH Ring <Exit>:")) )
(xdrx_begin)
(setq mp
(xdrx_hatch
->mpolygon e
) )
(xdrx_getpropertyvalue mp "ClosestLoopTo" p)
)
(xdrx_getpropertyvalue
mp
"childloops"
closestloop
)
)
)
(setq loopdata
(xdrx_getpropertyvalue mp
"MPolygonLoopAt" closestloop
)) (xdrx_polyline_make loopdata)
(xdrx_setpropertyvalue
(entlast) "constantwidth" 20.0 "color" 6) (setq loopdata
(xdrx_getpropertyvalue
mp
"MPolygonLoopAt"
x
)
)
(xdrx_polyline_make loopdata)
(xdrx_setpropertyvalue
"constantwidth"
20.0
"color"
2
)
)
childloops
)
)
)
(xdrx_entity_delete mp)
(xdrx_pickset_redraw e t)
(xdrx_end)
)
)
)
=============
The above LISP code uses the XDRX-API, which can be downloaded from
https://github.com/xdcad/XDrx-APIThe XDRX API encapsulates AcDb, AcEd, AcGe, AcBr... C++ library, using C++ methods to develop LISP programs.Thousands of Lisp functions are available.