Saturday, November 21, 2009
Home   |   Search   |   About AUGI   |   My AUGI   |   Join Now

Go Back   AUGI Forums > AUGI Technical (English) > Programming > AutoLISP
 Welcome, Guest. 

Login

Join Now FAQ Members List Calendar Search Today's Posts Mark Forums Read

AutoLISP AutoLISP or Visual LISP, learn both here!

Reply
 
Thread Tools Display Modes
Old 2004-07-01, 05:23 PM   #1
kieren
Member
 
kieren's Avatar
 
Join Date: 2003-04
Location: Stafford, UK
Posts: 34
kieren is starting their journey
Unhappy Xref insertion points

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.
__________________
..:: KIEREN ::..
Structural Draughtsman
kieren is offline   Reply With Quote
Old 2004-07-01, 06:32 PM   #2
WBIRT
Member
 
Join Date: 2004-05
Posts: 3
WBIRT is starting their journey
Default RE: Xref insertion points

Kieren,
Just use properties and change the x and y and rotation there. That way layers and settings for the xrefs stay the same.
WBIRT is offline   Reply With Quote
Old 2004-07-01, 07:27 PM   #3
kieren
Member
 
kieren's Avatar
 
Join Date: 2003-04
Location: Stafford, UK
Posts: 34
kieren is starting their journey
Default RE: Xref insertion points

Yeah, thought of that, but I have multiple xrefs in each model, and wanted to try and change by just "picking" the xref !! ??
__________________
..:: KIEREN ::..
Structural Draughtsman
kieren is offline   Reply With Quote
Old 2004-07-01, 10:21 PM   #4
stig.madsen
100 Club
 
Join Date: 2000-12
Posts: 126
stig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightly
Default

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).
Code:
(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
)
stig.madsen is offline   Reply With Quote
Old 2004-07-01, 10:59 PM   #5
kieren
Member
 
kieren's Avatar
 
Join Date: 2003-04
Location: Stafford, UK
Posts: 34
kieren is starting their journey
Default RE: Xref insertion points

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,
__________________
..:: KIEREN ::..
Structural Draughtsman
kieren is offline   Reply With Quote
Old 2004-07-01, 11:26 PM   #6
stig.madsen
100 Club
 
Join Date: 2000-12
Posts: 126
stig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightly
Default

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 ...)
stig.madsen is offline   Reply With Quote
Reply


Go Back   AUGI Forums > AUGI Technical (English) > Programming > AutoLISP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XREF - orphaned or "Not found" axa2001ro VBA 1 2004-06-21 04:42 PM
Xref vs Worksets Wagurto Revit Architecture - General 4 2004-06-19 03:54 AM
Scaling Points in Block jcronburg ACA General 3 2004-06-10 07:21 PM
Xref file is not loading for some reason... bjack56 AutoCAD General 11 2004-06-05 05:18 PM
reload xref - layers kca2.69080 ACA General 2 2004-06-02 11:44 PM


All times are GMT +1. The time now is 03:32 PM.