xref relative path

xref relative path

robert06
Collaborator Collaborator
1,527 Views
8 Replies
Message 1 of 9

xref relative path

robert06
Collaborator
Collaborator

Is there a way to overlay xrefs with relative path on command line with "-xref" at first place or is the only way to change the path type of already attached xref afterwards?

 

I use the command in lisp:

(command "-xref" "o" "~" "0,0,0" "1" "1" "0")

 

I don't find a variable of Path type, which can be selected with "xattach" command.

 

0 Likes
1,528 Views
8 Replies
Replies (8)
Message 2 of 9

ВeekeeCZ
Consultant
Consultant
The REFPATHTYPE system variable came up as new to 2018.
Message 3 of 9

Ranjit_Singh
Advisor
Advisor

If you use xattach, then you can specify the path type using below method. But -xref will always give full path and you have to adjust it afterwards (that's how it is in AutoCAD 2015)

Following values control the default setting in the "Attach External Reference" dialog box

0 - Relative Path
1 - Full path
2 - No path

 

To read current value

(vl-registry-read (strcat "HKEY_CURRENT_USER\\"
			  (vlax-machine-product-key)
			  "\\Profiles\\"
			  (getvar "cprofile")
			  "\\Dialogs\\XattachDialog")
		  "PathType")

To write current value (for example to set it to no path; value 2)

(vl-registry-write (strcat "HKEY_CURRENT_USER\\"
			   (vlax-machine-product-key)
			   "\\Profiles\\"
			   (getvar "cprofile")
			   "\\Dialogs\\XattachDialog")
		   "PathType"
		   2)

 

 

Message 4 of 9

robert06
Collaborator
Collaborator

Hi,

 

This applies only to "xattach" dialogue, does not affect path type of xref inserted with "-xref".

 

As a workaround, until 2018 is installed,  how could I get previously inserted xref name to apply

 

(command "-xref" "t" xrlast "r")

 

thank you

 

Robert

0 Likes
Message 5 of 9

cadffm
Consultant
Consultant

Let the file choose, then (if plausible) create the relative path itself.
Then you can specify the file directly with the relative path.

A folder above the current, file name MyXref.dwg
Name of ...:        ".. \ MyXref.dwg"

Sebastian

0 Likes
Message 6 of 9

robert06
Collaborator
Collaborator

Hi, thanks, but I'd like to automate this!

 

Robert

0 Likes
Message 7 of 9

cadffm
Consultant
Consultant

"Hi, thanks, but I'd like to automate this!"

wonderfull!

 

Now, tell us your new (Lisp-)Problem again Smiley Happy

Sebastian

0 Likes
Message 8 of 9

cadffm
Consultant
Consultant

 

So you only need a small one of the way <see attachment> *

*Just a working example to show the path construction, not to present clean code.

 

Pay attention to the COND case "higher folder, but than follow an other path"

 

There are some expressions nested and not commented,
If you have specific questions, ask!

 

 

Sebastian

Message 9 of 9

robert06
Collaborator
Collaborator

Thank you, I got your idea. As I'm not a programmer, I still used the "stupid way"

 

(command "-xref" "o" "~" "0,0,0" "1" "1" "0")
(setq ent (entlast))
(setq xrlast (vla-get-effectivename (vlax-ename->vla-object ent)))
(command "-xref" "t" xrlast "r")