getvar "dwgprefix" AutoLisp concatenate wrapped text

getvar "dwgprefix" AutoLisp concatenate wrapped text

d_r_wrightVF9D3
Advocate Advocate
2,505 Views
4 Replies
Message 1 of 5

getvar "dwgprefix" AutoLisp concatenate wrapped text

d_r_wrightVF9D3
Advocate
Advocate

Greetings,

I want to use DWGPREFIX for a few different LISP functions but just trying to figure out how to string the two lines together when the path is so long that it wraps around which is just about always. I am incredibly old and have used AutoLisp in my own primitive way for a long time but know very little about VLisp.

 

I know "STRCAT" but not sure how to grab this two lines of text as in the example below:

(getvar "dwgprefix")

 

will yield something like:

 

J:\\Customer\\bland peanut butter\\Minneapolis Minn 

cad\\drawings\\ours\\current\\

 

Thanks for any help,

Doug

Accepted solutions (2)
2,506 Views
4 Replies
Replies (4)
Message 2 of 5

Kent1Cooper
Consultant
Consultant
Accepted solution

Can you just put it in a variable, and feed that variable value into whatever needs to use it, rather than "select" it in the command-line area?  It will be a single text string without word wrapping, no matter how long.

 

(setq dwgpre (getvar 'dwgprefix))

Kent Cooper, AIA
Message 3 of 5

Jonathan3891
Advisor
Advisor
Accepted solution

something like this, perhaps?

 

(setq xdwgname (getvar 'dwgname))
(setq xdwgpath (getvar 'dwgprefix))

Jonathan Norton
Blog | Linkedin
Message 4 of 5

d_r_wrightVF9D3
Advocate
Advocate

Thanks for both replies. I misunderstood how the text would work in the LISP function. I thought that the two lines would have to be concatenated but I get it now.

 

Thanks for taking the time,

Doug

 

Message 5 of 5

CodeDing
Advisor
Advisor

@d_r_wrightVF9D3 ,

 

IF you're literally ONLY trying to get your drawing prefix into your clipboard for some odd reason (to each their own) (and if you're on Windows).. You can use this..

But if you're trying to use it as a variable somewhere.. then do not use this approach Lol.

(defun c:TEST ( / dp fName f)
(setq dp (getvar 'DWGPREFIX) fName (vl-filename-mktemp))
(write-line dp (setq f (open fName "w"))) (close f)
(command "_.SHELL" (strcat "c:\\windows\\system32\\clip.exe < \"" fName "\""))
(prompt "\nDrawing Prefix copied to clipboard.") (princ)
);defun

Best,

~DD