Attach an Xref with relative/Nopath option

Attach an Xref with relative/Nopath option

Anonymous
Not applicable
338 Views
7 Replies
Message 1 of 8

Attach an Xref with relative/Nopath option

Anonymous
Not applicable
Is any body knowswhether it is possible to attach an external reference through API with the following option or not
No Path/Relative path.

This options are available from the AutoCAd UI.

Thanks In advance
0 Likes
339 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
There's not an option while attaching, but you can change the Path property immediately after to remove the path or make it relative. HTH, Danny Polkinhorn WATG Honolulu manoj_vest wrote: > Is any body knowswhether it is possible to attach an external reference through API with the following option or not > No Path/Relative path. > > This options are available from the AutoCAd UI. > > Thanks In advance
0 Likes
Message 3 of 8

Anonymous
Not applicable
I tried your option and it is working fine. But my problem is as follows.

I have created a drawing with Xref option and has been saved on a particular location.
The Xref has been inserted using absolute path method.
Now I copied the drawing and its dependent file to a new location/ drive in a single folder. When I open the drawing which contains the xRef, it resolves the xreferences from the original location instead of from the current folder. But I need that whenever the file is opened it should open from the current folder.
For achieving this I tried to read the Xreferences and trying to detach the XReferences and attach from the new location with no path option. But while doing it I found that, If there is a nested XReference then the detach method of block not only fails but it crashes the AutoCAD. So this method too is not going to serve my purpose.

So can you advice what I should doo.

Thanks

Manoj
0 Likes
Message 4 of 8

Anonymous
Not applicable
Don't detach in the copy of the drawing. Simply created a filtered selection set of the inserted XRefs, and change the Path property of each ExternalReference object. -- R. Robert Bell "manoj_vest" wrote in message news:32513143.1085043971423.JavaMail.jive@jiveforum2.autodesk.com... I tried your option and it is working fine. But my problem is as follows. I have created a drawing with Xref option and has been saved on a particular location. The Xref has been inserted using absolute path method. Now I copied the drawing and its dependent file to a new location/ drive in a single folder. When I open the drawing which contains the xRef, it resolves the xreferences from the original location instead of from the current folder. But I need that whenever the file is opened it should open from the current folder. For achieving this I tried to read the Xreferences and trying to detach the XReferences and attach from the new location with no path option. But while doing it I found that, If there is a nested XReference then the detach method of block not only fails but it crashes the AutoCAD. So this method too is not going to serve my purpose. So can you advice what I should doo. Thanks Manoj
0 Likes
Message 5 of 8

Anonymous
Not applicable
Thanks for your input. I tried the same but the problem is that even after changing the path property the document is refering the drawing from the original location only. For refering it from the current location I need to save the drawing after changing the path property. Close the document and again re-open it. Closing and re-opening is some thing iritating. So I don't want that. So it it possible that the drawing is refering from the current location without re-opening it?

Thanks once again

Manoj
0 Likes
Message 6 of 8

Anonymous
Not applicable
This sample assumes only one object in model space, an XRef named "Det" with an absolute path. It replaces the path with just the drawing's filename which is also saved in the current folder of the test drawing. Sub Test() Dim myXRef As AcadExternalReference Set myXRef = ThisDrawing.ModelSpace.Item(0) Debug.Print "Old path=" & myXRef.Path myXRef.Path = "Det.dwg" Debug.Print "New path=" & myXRef.Path Set myXRef = Nothing Dim xrDef As AcadBlock Set xrDef = ThisDrawing.Blocks.Item("Det") xrDef.Reload AcadApplication.ZoomExtents Set xrDef = Nothing End Sub -- R. Robert Bell "manoj_vest" wrote in message news:27703406.1085113683000.JavaMail.jive@jiveforum1.autodesk.com... Thanks for your input. I tried the same but the problem is that even after changing the path property the document is refering the drawing from the original location only. For refering it from the current location I need to save the drawing after changing the path property. Close the document and again re-open it. Closing and re-opening is some thing iritating. So I don't want that. So it it possible that the drawing is refering from the current location without re-opening it? Thanks once again Manoj
0 Likes
Message 7 of 8

Anonymous
Not applicable
Robert,

Thanks for your help, Now it is working greate inside AutoCAD. The only problem I am having that I am unable to either dettach or reload the external references inside Mechanical AutoCAD. I don't know why?

Thanks once again?
0 Likes
Message 8 of 8

Anonymous
Not applicable
For MDT/Mechanical you might need to check out its object model (I haven't had MDT since v4, so I don't have a way to help you there.) -- R. Robert Bell "manoj_vest" wrote in message news:21073273.1085377073916.JavaMail.jive@jiveforum1.autodesk.com... Robert, Thanks for your help, Now it is working greate inside AutoCAD. The only problem I am having that I am unable to either dettach or reload the external references inside Mechanical AutoCAD. I don't know why? Thanks once again?
0 Likes