Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using DWGPREFIX to get a directory name.

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
stanovb
595 Views, 3 Replies

Using DWGPREFIX to get a directory name.

I've seen a couple of routines that are using "DWGPREFIX " to get the folder name in a network directory but then they have a couple of numbers after the substr. Here is an example:

 

(Setq dwgnm (substr (getvar "dwgprefix")5 2))
(Setq dwgnm1 (substr (getvar "dwgprefix")22 2))

 

Does anyone have any idea what this could be for? I've seen this in a couple of routines that have numbers as part of the substr but i dont know what it refers to.

3 REPLIES 3
Message 2 of 4
p_mcknight
in reply to: stanovb

substr allows you to get substrings from anywhere in a string.  The first number is the index of where to start while the second is the string length to return.  Hence, (substr "ABCD" 2 2) would return "BC".  The examples you saw were probably getting a specific part of the path based off of a structured folder naming system.

Message 3 of 4
mid-awe
in reply to: stanovb

Yours is a substr question. Take a look at the documentation.

 

substr

Message 4 of 4
stanovb
in reply to: p_mcknight

Thanks to you both. That makes perfect sense.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost