Kenter Posted August 3, 2010 Posted August 3, 2010 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 Quote
Hippe013 Posted August 3, 2010 Posted August 3, 2010 It can certainly be done. Type the following code into the command line. (setq name (getvar "DWGNAME")) Afterwhich type: !name on the command line. Quote
alanjt Posted August 3, 2010 Posted August 3, 2010 Also, (getvar 'dwgprefix) will give you the location. Quote
Kenter Posted August 3, 2010 Author Posted August 3, 2010 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 Quote
Tharwat Posted August 3, 2010 Posted August 3, 2010 Thank you both. I used:It grabbed it without taking the .dwg at the end. Kenter Really a very smart result . you do have the ability to get through codes. Best regards Tharwat Quote
Tharwat Posted August 3, 2010 Posted August 3, 2010 or (vl-filename-base (getvar 'dwgname)) Undoubtly , this is the shortest and direct one ..... Quote
alanjt Posted August 3, 2010 Posted August 3, 2010 Undoubtly , this is the shortest and direct one ..... faster too Quote
Lee Mac Posted August 3, 2010 Posted August 3, 2010 Unnecessary, but for the VL-phobic: (substr (getvar 'DWGNAME) 1 (- (strlen (getvar 'DWGNAME)) 4)) Or (cadr (fnsplitl (getvar 'DWGNAME))) Quote
Hippe013 Posted August 3, 2010 Posted August 3, 2010 (cadr ([color=red]fnsplitl[/color] (getvar 'DWGNAME))) Lee you are a dictionary of undocumented lisp functions! Quote
Lee Mac Posted August 3, 2010 Posted August 3, 2010 lee you are a dictionary of undocumented lisp functions! .. :) ... Quote
Recommended Posts
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.