Relative Path Changes to Absolute Path in DWT

louis.banks
Contributor
Contributor

Relative Path Changes to Absolute Path in DWT

louis.banks
Contributor
Contributor

Hi

I am currently creating a new AutoCAD profile that will bring in our paperspace sheets via a macro script in a command in the tool palette that's stored on our network.

 

The command for bringing in the, A0 sheet, for example is:

^C^R_filedia;0;^C^R_layout;t;"S:/GB/DesignDB/Workspace/Autodesk/AutoCAD/BS_Custom/Templates/DWT_For_LISP_Sheet_Import/BS_A0"

Where 'BS_A0' is 'BS_A0.DWT'.

Inside the DWT is a sheet that is inside the drawing, some blocks and text. There is also an XREF that is deliberately relatively XREFFED:

..\Arch\Template files\Titleblock_Attributes\A0_A1_A3_PROJECT_ATTRIBUTE.dwg

When the DWT is loaded via the command from the tool palette, the XREF changes from relative to absolute (a network path).

The idea is that once the drawing is saved in a correct project folder location and then reopened, the relative path will find that relative XREF thats in the ..\Arch\Template files\Titleblock_Attributes\ folder. This is to prevent repeat work (filling out client/project name/ numbers) for each drawing.

 

Can anyone let me know why the DWT import via macro changes this from relative to absolute?

 

Thanks

 

0 Likes
Reply
484 Views
10 Replies
Replies (10)

pendean
Community Legend
Community Legend
AFAIK that's how AutoCAD works, it always tries to help resolve a missing relative path when you move/copy that master file.
0 Likes

dmfrazier
Advisor
Advisor

In the current (destination) drawing, check the value of system variable REFPATHTYPE. Is it set to "1"?

0 Likes

louis.banks
Contributor
Contributor

ive tried all 3 variables and none do the trick. but originally yes it was 1

0 Likes

louis.banks
Contributor
Contributor

as in, in order for something to be relative, it needs to be relative to something, so a place, a save place. i.e. needs to be saved before it can be relative, conceptually?

0 Likes

dmfrazier
Advisor
Advisor

"Inside the DWT is a sheet that is inside the drawing, some blocks and text. There is also an XREF that is deliberately relatively XREFFED:

..\Arch\Template files\Titleblock_Attributes\A0_A1_A3_PROJECT_ATTRIBUTE.dwg"

 

(Just trying to fully understand what's happening here.)

 

In the template, AutoCAD resolves this XREF (with a relative path) by finding it in the existing folder relative to the location of the template, right?

 

"...once the drawing is saved in a correct project folder location and then reopened..."

 

Once the layout is imported from the DWT into another DWG, from where do you expect AutoCAD to then find/resolve the XREF? How is the new DWG's path different from the DWT's path? Does that location (presumably different from the resolved/found location within the DWT) exist at the time of the import? Does a copy of the XREFfed DWG exist in that other location?

0 Likes

louis.banks
Contributor
Contributor

in order to test and create the dwts we created a mock arch folder with xref in question in it, so that we could set it relative and then export the dwt from the dwg

so yes it resolves it relative to the template (the absolute path it gives is the same as the relative path, just not relative)

we expect autocad to have it as not found but still relative. the idea is that the caddy saves the drawing in a project folder location which will have the xref in question in the same folder structure relative to, the relative path so that once that drawing is saved and reopened (or xref reloaded) it will pick up the one found in the project folder

so yes the final save place does have a copy of that dwg xref saved there

hope this makes sense

0 Likes

dmfrazier
Advisor
Advisor

"...we expect autocad to have it as not found but still relative."

 

And this is (apparently) where the problem occurs.

 

"...the idea is that the caddy saves the drawing in a project folder location which will have the xref in question in the same folder structure relative to, the relative path so that once that drawing is saved and reopened (or xref reloaded) it will pick up the one found in the project folder.

so yes the final save place does have a copy of that dwg xref saved there."

 

Does this "final save place" and the "copy of that dwg xref" occur before or after the import of the layout from the DWT?  Based on your earlier description, I think the answer is after (but maybe I'm confused, which is not uncommon).

 

If so, can it be before, so that the "not found" (or apparent conversion to absolute) is avoided?

 

0 Likes

louis.banks
Contributor
Contributor

it occurs after because the dwt being brought in as a layout is the base of the drawing, its then saved to that project location with the idea then after reopening or xref reload, the dwg xref identically saved as the relative path is, in the project folder, is picked up

ive just tried saving the blank drawing in said location and then importing the layout sheet via the command button with no luck

0 Likes

pendean
Community Legend
Community Legend
But... that's not how the program works, so... try something else. Like NONE
0 Likes

dmfrazier
Advisor
Advisor

Gotcha.

Have you done any experimenting with the "no path" option? I think in this case AutoCAD uses the Support Files Search Path settings to resolve a pathless XREF (after not finding it in the current DWG's folder).

To make it work, it may be necessary to programmatically add the correct path. (This can be done easily with LISP.)

Maybe AutoCAD will still convert to an absolute path.

Maybe it's worth a try?

0 Likes