Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stripping and adding text to a variable 1

Status
Not open for further replies.

Volk359

Technical User
Jun 30, 2004
395
US
Greetings All,

We have a number of images that need to be inserted into it's own cad file. I have most of the routine figured out but need a bit of help getting AutoCAD to find the proper image. Each image has the same name as the cad file, and is in the same directory, so I'd like the lisp to take the drawing name (getvar "dwgname"), strip the "dwg" off the end and add "tif".

Can someone give me a hand here? (no puns please)

Thanks
 
How about this
(setq FileName (subsrt FileName 1 (- (strlen FileName) 4))
where FileName is the variable you store the drawing name in.


Kevin Petursson
--
"Everyone says quotable things everyday, but their not famous... so nobody cares."... Some Person
 
And the final product is:

(setq filename (getvar "dwgname"))
(setq filename (substr filename 1 (- (strlen FileName) 3)))
(setq filename (strcat filename "tif"))
(command "image" "a" filename "0,0" "1" "0")

Thanks for the input!
 
Glad I could help

Kevin Petursson
--
"Everyone says quotable things everyday, but their not famous... so nobody cares."... Some Person
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top