Jump to content

Recommended Posts

Posted

Is there a way to grab the name of the file you are working on, and store it as a variable??

 

eg.

You open a file called 'square', and you want to take the drawing name and store it as variable 'name'.....

 

Not sure if this can be done, but if it is possible, the answer would be found on this forum for sure.

 

Kenter

Posted

It can certainly be done. Type the following code into the command line.

 

 
(setq name (getvar "DWGNAME"))

 

Afterwhich type: !name on the command line.

Posted

Also, (getvar 'dwgprefix) will give you the location.

Posted

Thank you both. I used:

 

(setq name (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 4)))

It grabbed it without taking the .dwg at the end.

 

 

Kenter

Posted

or

(vl-filename-base (getvar 'dwgname))

  • Like 1
Posted
Thank you both. I used:

It grabbed it without taking the .dwg at the end.

Kenter

 

Really a very smart result . :thumbsup: you do have the ability to get through codes.

 

Best regards

 

Tharwat

Posted
or

(vl-filename-base (getvar 'dwgname))

 

Undoubtly , this is the shortest and direct one ..... :thumbsup:

Posted
Undoubtly , this is the shortest and direct one ..... :thumbsup:

faster too

Posted

Unnecessary, but for the VL-phobic:

 

(substr (getvar 'DWGNAME) 1 (- (strlen (getvar 'DWGNAME)) 4))

 

Or

 

(cadr (fnsplitl (getvar 'DWGNAME)))

Posted

(cadr ([color=red]fnsplitl[/color] (getvar 'DWGNAME)))

 

Lee you are a dictionary of undocumented lisp functions! :D

Posted
lee you are a dictionary of undocumented lisp functions! :D

 

.. :) :) :) ...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...