View Full Version : Xref insertion points
kieren
2004-07-01, 05:23 PM
Complete brain freeze here!
Anyone know how I can just select an already inserted xref and change its values so that the insertion point is 0,0 and its rotation is 0 degrees?
Got a drawing with lots of xrefs attached but for some reason have been moved and rotated. I need to get them back to original co-ords. Don't fancy reloading all as this will change my layer state.
Thanks. :roll:
WBIRT
2004-07-01, 06:32 PM
Kieren,
Just use properties and change the x and y and rotation there. That way layers and settings for the xrefs stay the same.
kieren
2004-07-01, 07:27 PM
Yeah, thought of that, but I have multiple xrefs in each model, and wanted to try and change by just "picking" the xref !! ??
stig.madsen
2004-07-01, 10:21 PM
Here's just a quick and basic one (you can insert code to pick an object and get the name to process one at a time if you like).
(defun resetXrefs (/ a b xset ent entl)
(cond
((setq xset (ssget "X" '((0 . "INSERT"))))
(setq a 0 b 0)
(repeat (sslength xset)
(setq ent (ssname xset a)
entl (entget ent)
a (1+ a)
)
(cond
((>= (cdr (assoc 70 (tblsearch "BLOCK" (cdr (assoc 2 entl))))) 4)
(setq entl (subst '(10 0.0 0.0 0.0) (assoc 10 entl) entl)
entl (subst (cons 50 0.0) (assoc 50 entl) entl)
)
(and (entmod entl)(setq b (1+ b)))
)
)
)
)
)
b
)
kieren
2004-07-01, 10:59 PM
Stig,
To the rescue again - thanks!
Works a treat. A question or two though -
-- does this only work with xrefs, or does it pick up blocks too? (just glancing at code)
-- does it only pick up xrefs in MS (which is what I need - some of our drawings have xrefs as title block info in PS which I dont want moving)
Regards,
stig.madsen
2004-07-01, 11:26 PM
It assumes that block definitions with a code 70 flag equal to or greater than 4 are xrefs, which is pretty safe as SSGET only grabs main entities. So yes, it'll will only select xrefs.
To only make it select xrefs in MS, insert an extra filter of (67 . 0), i.e. (ssget "X" '((0 . "INSERT")(67 . 0)))
To make it exclude certain xrefs, collect the names you want to exclude (or hardcode it) and
1. insert a filter with code 2 with a negator, e.g. (setq ss (ssget "X" '((0 . "INSERT")(67 . 0)(2 . "~*title*")))) or something like that (check out WCMATCH in the help files to see what is allowed).
Or 2., just skip the xrefs while in the loop, e.g. (if (not (member this_name list_of_names_to_exclude)))(... proceed ...)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.