You can specify one to Detach, or you can Detach all of them.
(defun c:XDTB_HaDetach (/ $ha_extractall $ha_extractsingle sel ss num clone)
(defun $ha_extractall (/ num ss)
(xdrx-prompt
(if (xd::doc:acadischs)
"\n请选取要分解的HATCH实体<退出>:"
"\nPlease select the HATCH entity to be Detach<Exit>:"
)
)
(if (setq ss
(xdrx-ssget
(xdrx-prompt
(if (xd::doc:acadischs)
"\n请选取要分解的HATCH实体<退出>:"
"\nPlease select the HATCH entity to be Detach<Exit>:"
)
t
)
'((0 . "hatch"))
)
)
(progn
(setq clone (xdrx-object-clone (ssname ss 0)))
(if (and (setq ss1 (xdrx_hatch_explode ss t))
(> (setq num (sslength ss1)) 0)
)
(progn
(xdrx-prompt
(xdrx-string-formatex
(if (xd::doc:acadischs)
"\n分解出 %d 个HATCH实体。"
"\nDetach %d HATCH entities."
)
num
)
)
(xdrx-entity-matchprop clone ss1)
(xdrx-entity-delete clone)
)
(xdrx-prompt
(if (xd::doc:acadischs)
"\n没有发现有多个外部环的HATCH实体。"
"\nNo HATCH entity with multiple external Loops found."
)
)
)
)
)
)
(defun $ha_extractsingle (/ e pt num tf)
(if (and
(setq tf t)
(setq e
(xdrx_entsel
(if (xd::doc:acadischs)
"\n请在要分解的单个填充上点一下<退出>:"
"\nPlease click on the individual fill you want to Detach<Exit>:"
)
'((0 . "hatch"))
)
)
(setq pt
(cadr e)
e (car e)
)
(xdrx-entity-redraw e 3)
(and
(or
(> (length
(xdrx-getpropertyvalue e "rootloops")
)
1
)
(xdrx-prompt
(if (xd::doc:acadischs)
"\n该HATCH没有多个外部环。"
"\nThe HATCH does not have multiple external Loops."
)
)
(setq tf nil)
)
tf
)
)
(progn
(xdrx-setmark)
(xdrx_hatch_explode e pt)
(setq ss (xdrx-getss))
(if (> (sslength ss) 0)
(progn
(xdrx-prompt
(if (xd::doc:acadischs)
"\n已经从有多个外部环的HATCH提示成功提出一个HATCH。"
"\nA HATCH has been successfully raised from a HATCH prompt with multiple external Loops"
)
)
(xdrx-entity-matchprop e ss)
(xdrx-entity-redraw ss 4)
)
(xdrx-prompt
(if (xd::doc:acadischs)
"\n该HATCH没有多个外部环,没有提取成功。"
"\nThe HATCH does not have multiple external Loops and the extraction was not successful."
)
)
)
)
)
)
(xdrx_begin)
(xdrx_initget 6 "A S")
(if (not (setq sel
(getkword
(if (xd::doc:acadischs)
"\n方式[所有(A)/单个(S)]<A>:"
"\nMethod [All(A)/Single(S)]<A>:"
)
)
)
)
(setq sel "A")
)
(cond
((= Sel "A")
($ha_extractAll)
)
((= Sel "S")
($ha_extractSingle)
)
)
(xdrx_end)
(princ)
)