Update xref insertion to 0,0,0

Update xref insertion to 0,0,0

bsanada
Advocate Advocate
5,326 Views
56 Replies
Message 1 of 57

Update xref insertion to 0,0,0

bsanada
Advocate
Advocate

We have a master drawing that pulls in several hundred xrefs and most xrefs do not have a 0,0,0 insertion point.  I am looking for a lisp routine that would create a copy of each xref drawing with an updated insertion point allowing each drawing to be inserted using 0,0,0.  There may be a couple ways to skin this cat but my intitial thought would be to bind the xrefs and then wblock them back out.

0 Likes
Accepted solutions (1)
5,327 Views
56 Replies
Replies (56)
Message 21 of 57

Moshe-A
Mentor
Mentor

@bsanada ,

 

Well the issue was your master drawing was not on world ucs - attached a fixed version - now working good 🙏

 

Moshe

 

0 Likes
Message 22 of 57

bsanada
Advocate
Advocate

Unfortunately I am getting the same error.  It hangs immediately in the original files.  In the simplified version I sent you it does bind one xref, rotates it and then hangs.

 

Thanks,
Brad

0 Likes
Message 23 of 57

Moshe-A
Mentor
Mentor

@bsanada ,

 

Attached is 'debug' version. run it and send a picture of AutoCAD text window [F2] so i can see where it stops

What is the AutoCAD version you are using, is it LT?

 

Moshe

 

0 Likes
Message 24 of 57

bsanada
Advocate
Advocate

Here are the screenshots from each the orignal file and the simplified file.  I am using vanilla AutoCAD 2024 (not LT).

 

Thanks! Brad

0 Likes
Message 25 of 57

pendean
Community Legend
Community Legend

@bsanada Seems to hang here

pendean_0-1738332912252.png

 

0 Likes
Message 26 of 57

Moshe-A
Mentor
Mentor

@bsanada 

 

Sorry, here is my picture - works

i also running R2024

 

 

0 Likes
Message 27 of 57

bsanada
Advocate
Advocate

Interesting.  Any thoughts about a variable that might need to be changed in order for this to run?

0 Likes
Message 28 of 57

Moshe-A
Mentor
Mentor

does your AutoCAD has all updates?

do zoom all before run

 

 

0 Likes
Message 29 of 57

bsanada
Advocate
Advocate

Autodesk Access does not show any updates and Zoom All returns the same error in the same spot.

0 Likes
Message 30 of 57

Moshe-A
Mentor
Mentor

@bsanada ,

 

i now notice that in your master (sample) drawing some blocks are not xref

try this fix

 

Message 31 of 57

bsanada
Advocate
Advocate

This is very close!  The attached screenshot shows the processed xrefs (in the pinkish color) pulled back in over the orignal drawing.  The xrefs that were rotated are not coming back in properly.

 

Thanks! Brad

0 Likes
Message 32 of 57

Sea-Haven
Mentor
Mentor

I am confused, I have a dwg with a XYZ location, insbase as 0,0,0. I xref that dwg into another using 0,0,0 as insertion point, when I look at a point on my xref I get correct matching co-ordinates, X=100.0000 Y=100.0000 Z=200.0000. 

 

So if your 100 xrefs are all at 0,0,0 then how do you work out where they should be inserted in the master dwg ? It is possible to take the XREFS using a bounding box method etc to move all objects to a lower left corner of 0,0,0 then save the xref, is this what your trying to do ? So when you xref in you set correct insertion point XYZ. If you need a point in the objects then I can only see a manual pick a point and objects are moved based on that point to 0,0,0 and saved. You could write a script that opens the dwg's and asks for a point or just move. 

SeaHaven_0-1738373973733.png

 

 

 

0 Likes
Message 33 of 57

Moshe-A
Mentor
Mentor

@bsanada ,

 

This is very close means the program is working down to end?

 

if this is the result, than it is not because if you review the code you will see i use undo begin than process an xref

and at end undo end and call one U to restore the whole process. this intermediate undo should keep your

master drawing intact if it runs down to end.

 

from the error i assume the explode command doesn't get the binded xref (new created block) but another object that can not be explode.

try to identify this object.

 

Moshe

 

 

0 Likes
Message 34 of 57

bsanada
Advocate
Advocate

I believe the routine is running to the end, but the exported xrefs that had a rotation other than 0 are not rotated correctly when you try to reinsert them.  The pinkish items in the screenshot I last posted are the reinserted xrefs after they had been processed.

0 Likes
Message 35 of 57

Moshe-A
Mentor
Mentor

@bsanada ,

 

ok this is a progress 😀

 

my first intention was to write out the block/xref as it was inserted in master (before modifying it). now i understand you want to write it out as you placed them after attach. then what you have to do, is put in comment lines 128-132 in the code (see previous page, my first message)

 

do you know how?

 

Moshe

 

 

0 Likes
Message 36 of 57

bsanada
Advocate
Advocate

Unfortunately I am not very proficient with LISP code.  Certainly no rush and I really appreciate your help with this!

 

Thanks,
Brad

0 Likes
Message 37 of 57

Moshe-A
Mentor
Mentor
Accepted solution

@bsanada ,

 

here you go

 

Remember to make sure all xrefs are loaded and bindable (if not invoke XREF reload *)

 

Moshe

 

0 Likes
Message 38 of 57

bsanada
Advocate
Advocate

Thanks. I am traveling this morning and will let you know the results once I get a chance to test it out. 

0 Likes
Message 39 of 57

bsanada
Advocate
Advocate

Moshe,

 

After attempting the new routine it crashed right away (see image below).  I did confirm the xrefs would bind.

 

Thanks,
Brad

 

bsanada_0-1738621433918.png

 

0 Likes
Message 40 of 57

Moshe-A
Mentor
Mentor

@bsanada ,

 

1. to be aligned with me test it on the file you send me

2. do xref reload * (all)

3. run xrefout

 

Moshe

 

0 Likes