Different from ACAD's HATCH entity, the HATCH and boundary LOOP processed by the API have complete "topological" relationships.
1.
Merge (MERGE)(xdrx_hatch_merge <ss ... ent>)
2.
Detachment (DETACH) 1). Specify the point location and remove a HATCH with independent topology relationship.
(xdrx_hatch_detach ent pnt)
(xdrx_getpropertyvalue ent "detach" pnt)

2). Detach all HATCHs with independent topological relationships
(xdrx_hatch_detach ent t)
(xdrx_getpropertyvalue ent "detach" t)
3.
Extract a HATCH with independent topological relationship (xdrx_getpropertyvalue ent "extractloopat" pnt)

(if (and (setq e
(car (xdrx_entsel
"\nPickup HATCH<exit>:" '
((0 .
"hatch"))))) (setq ss
(xdrx_getpropertyvalue e
"extractloopat" pnt
)) (xdrx_entity_setcolor ss (xdrx_math_rand 0 40))
)
(xd::drag:simplemove ss "\nInsertion point:" 5 t)
)
)
4.
HATCH --> REGION (with topological relationship) (xdrx_hatch->region <ss ...ent ...>)
5.
HATCH --> MPOLYGON (with topological relationship) (xdrx_hatch->mpolygon <ss ...ent ...>)
6.
HATCH --> Boundary LOOP geometric entity table
(xdrx_getpropertyvalue ent "getloops")
The following code demonstrates obtaining the boundary geometry entity table, then generating a polyline and moving it.

(if (and (setq e
(car (xdrx_entsel
"\nPickup HATCH<exit>:" '
((0 .
"hatch"))))) (setq ents
(xdrx_getpropertyvalue e
"getloops")) )
(xdrx_entity_setcolorss 7)
(xd::drag:simplemove ss "\nInsertion point:" 5 t)
(xdge::free ents)
)
)
)
7.
HATCH --> "Root Loops (obtain the root LOOP of the topological relationship)" (xdrx_getpropertyvalue ent "rootloops" [t])
Give T parameter, directly generate GE geometric entity, otherwise return LOOP index number (integer)
The following code demonstrates obtaining the ROOT boundary geometric entity table, then generating a polyline and moving it.

(if (and (setq e
(car (xdrx_entsel
"\nPickup HATCH<exit>:" '
((0 .
"hatch"))))) (setq ents
(xdrx_getpropertyvalue e
"rootloops" t
)) )
(xdrx_entity_setcolorss 7)
(xd::drag:simplemove ss "\nInsertion point:" 5 t)
(xdge::free ents)
)
)
)
8.
HATCH --> Child Loops (obtain all child LOOPs under a certain root LOOP of the topological relationship) (xdrx_getpropertyvalue ent "childloops" <ent or pnt or inx integer index or t>)
Give the T parameter and get all sub-LOOPs.
Return the LOOP index number table
The following code demonstrates obtaining all sub-LOOP boundary geometric entity tables under ROOT, then generating polylines and moving them.

(if (and (setq e
(car (xdrx_entsel
"\nPickup HATCH<exit>:" '
((0 .
"hatch"))))) (setq pnt
(getpoint "\nPick point <exit> under a certain ROOT:")) (setq ents
(xdrx_getpropertyvalue e
"childloops" pnt
)) )
(setq e1
(xdrx_getpropertyvalue e
"getloopat" x
)) (setq e2
(xdge::entity:make e1
)) (xdge::free e1)
)
ents
)
(xdrx_entity_setcolorss 7)
(xd::drag:simplemove ss "\nInsertion point:" 5 t)
)
)
)
9.
HATCH --> Parent Loops (obtain the parent LOOP of a certain child LOOP in the topological relationship) (xdrx_getpropertyvalue ent "parent" <ent or pnt or inx integer index>)
The following code demonstrates obtaining the parent LOOP boundary geometric entity table of the child ROOT, then generating a polyline and moving it.

(if (and (setq e
(car (xdrx_entsel
"\nPickup HATCH<exit>:" '
((0 .
"hatch"))))) (setq pnt
(getpoint "\nPick point under a certain sub-ROOT <exit>:")) (setq inx
(xdrx_getpropertyvalue e
"parentloop" pnt
)) )
(progn (setq e1
(xdrx_getpropertyvalue e
"getloopat" inx
)) (setq e2
(xdge::entity:make e1
)) (xdge::free e1)
(xdrx_entity_setcolor e2 7)
(xd::drag:simplemove e2 "\nInsertion point:" 5 t)
)
)
)
10.
HATCH --> Get the boundary LOOP geometric entity of the specified index (xdrx_getpropertyvalue ent "getloopat" <inx>)
11.
HATCH --> Give a point and get the nearest LOOP index of the point (xdrx_getpropertyvalue ent "LoopIndexAt" <pnt>)
(xdrx_getpropertyvalue ent "ClosestLoopTo" <pnt>)
12.
HATCH --> Get the number of LOOPs (xdrx_getpropertyvalue ent "NumLoops")
13.
HATCH --> Get the ROOT LOOP of the topological relationship of the specified entity, point nearby or specified index (xdrx_getpropertyvalue ent "RootLoop" <ent or pnt or inx> [t])
Returns the geometric entity for the T parameter, otherwise returns the index number
14.
Query the topological relationship of the filled entity boundary (xdrx_get_topology ent)
Returns the topology structure table of the boundary LOOP, such as:
Command: (xdrx_get_topology (car (entsel)))
Select objects: ((0 (1) (2 (3))) (4 (5 (6))) (7 (

) (9 (10) (11 (12))))
15.
HATCH area (The HATCH area without HATCH area attribute area is 0 can be calculated) (xdrx_get_area ent)
(xdrx_getpropertyvalue ent "area")
General entity attribute query function xdrx_getpropertyvalue about HATCH: (xdrx_getpropertyvalue (car (entsel)))
Select object:
Class AcDbHatch:
├─Area
├─AssocObjIds
├─Detach
├─DetachLoopAt (Point)
├─ExtractLoopAt (Point)
├─Length
├─ShadeTintValue
├─GradientShift
├─GradientAngle
├─GradientName
├─GradientType
├─HatchLines
├─HatchObjectType
├─IsGradient
├─IsHatch
├─IsSolidFill
├─Elevation
├─HatchStyle
├─Normal
├─NumPatternDefinitions
├─PatternAngle
├─PatternScale
├─PatternSpace
├─PatternName
├─PatternDouble
├─PatternType
├─NumHatchLines
├─LoopIndexAt
├─loopTypeAt ├─LineGenerationEnabled(2007+)
├─OriginPoint(2007+)
Loops Class:
├─ClosestLoopTo
├─GetLoops
├─GetLoopAt
├─NumLoops
├─RootLoop
├─RootLoops
├─ParentLoop
├─ChildLoops
General entity attributes about HATCH editing function xdrx_setpropertyvalueCommand: (xdrx_setpropertyvalue (car (entsel)))
Select objects:
Class AcDbHatch:
├─ShadeTintValue(Real)
├─GradientShift(Real)
├─GradientAngle(Real)
├─GradientName(STR)
├─GradientType
├─HatchObjectType(0 or 1)
├─Gradient(0 or 1 and STR)
├─Elevation(Real or Int)
├─HatchStyle(0 or 1 or 2)
├─Normal(Vector)
├─PatternAngle(Real)
├─PatternScale(Real)
├─PatternSpace(Real)
├─PatternName(0 or 1 or 2 and STR)
├─PatternDouble(T or Nil)
├─PatternType(0 or 1 or 2)
├─appendLoop (looptype (ent1,ent2...pickset))
├─removeLoopAt (loopinx)
├─LineGenerationEnabled(T or Nil)(2007+)
├─OriginPoint(Point)(2007+)
=============
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.