TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: danny on May 20, 2005, 06:05:31 PM
-
I was trying to detach a bunch of xrefs with similar names. here's my try
(defun c:xrdetach ()
(setq sset
(ssget
"x"
'((2 . "*SiteandStream*"))
)
)
(if sset
(repeat (sslength sset)
(command "_.xref" "detach" sset)
)
)
)
I was hoping that the asteric would dork similar with xrefs as it does with layers.
Here is a few examples of xrefs I'm trying to detach
IMP-DrawingSheet-AS-108-PARKINGPLANS-IMPSiteandStream.rvt-1.dwg
IMP-DrawingSheet-AS-104-OVERALLLEVEL2FLOOR-GRIDPLAN-IMPSiteandStream.rvt-1.dwg
IMP-DrawingSheet-AH-104-BUILDINGHLEVEL1REFLCEILINGPLAN-IMPSiteandStream.rvt-1.dwg
You can see that they all have different names, but are similar by having "SiteandStream"
-
:lol:
-
Well since the Xref-delete command asks for the name of the xref, you should pass that to it. You were close:
(defun c:xrdetach (/ sset idx xrname)
(setq sset
(ssget
"x"
'((2 . "*SiteandStream*"))
)
)
(if sset
(progn
(setq idx 0)
(repeat (sslength sset)
(setq xrname (cdr (assoc 2 (entget (ssname sset idx)))))
(command "_.xref" "detach" xrname)
(setq idx (1+ idx))
)
)
)
(princ)
)
:)
-
hmm...intresting.
what if I had a list of xrefs to delete say
*SiteandStream*
*MirmarOption*
*CoralReef*
-
Just add them to the filter:
(ssget "x" '((2 . "*SiteandStream*,*MirmarOption*,*CoralReef*")))
-
much Mahalo's Jeff, :)