Jump to content

Recommended Posts

Posted

I am trying to learn lisp and write a lisp that will take whatever current drawing file I have open and save it automatically to a different location on our server after I run the lisp. I have looked through the AutoCad lisp tutorial on how to get the name of the current drawing file, but I am unsure what I need to use. Is it "vl-filename-base"? Thanks for any help you can give me.

Posted

Current Drawing:

 

(getvar 'DWGNAME)

 

Current Drawing Path:

 

(getvar 'DWGPREFIX)

 

Current Drawing Filepath:

 

(strcat (getvar 'DWGPREFIX) (getvar 'DWGNAME))

Posted (edited)

Thanks Lee Mac! I tried using this but it isn't working right just yet. It saves a file to the location I want to put it in, but it is giving it an incorrect filename. This is what I have:

 

(SETQ FILENAME (GETVAR 'DWGNAME))
    (COMMAND "_SAVEAS" "2010" "N:/Projects/Contractors/Ft. Benning Martin Army Hospital/VDC/09-Other Files/Upload Folder/FILENAME")

 

I tried modifying this to:

 

(SETQ FILENAME (GETVAR 'DWGNAME))
    (COMMAND "_SAVEAS" "2010" "N:/Projects/Contractors/Ft. Benning Martin Army Hospital/VDC/09-Other Files/Upload Folder/[color="red"]" FILENAME[/color])

 

but that didn't work either. I just can't seem to figure out how to get the value to return as the value to name the new file. What am I doing wrong?

Edited by ksperopoulos
Posted

Sorry. Fixed it.

Posted (edited)

First I think you can not save as your current drawing to 2010 since you are using 2009 .:wink:

 

Try this .

 

(SETQ FILENAME (GETVAR 'DWGNAME))
(COMMAND "_SAVEAS"  "2010" (strcat "N:\\Projects\\Contractors\\Ft. Benning Martin Army Hospital\\VDC\\09-Other Files\\Upload Folder\\" FILENAME))

Edited by Tharwat
EDIT : strcat added
Posted

Oops! I haven't updated my profile in a while. We are actually on 2011. I wish that was my problem. That would be an easy fix.

Posted
Sorry. Fixed it.

 

Thank you, very much.

Posted

Hint: Take a look at how I have used the strcat function in my first post. :wink:

Posted

I think I finally got it. It put the file (with the correct file name) in the correct folder. Is this how it should look?

 

(COMMAND "_SAVEAS" "2010" (STRCAT "N:/Projects/Contractors/Ft. Benning Martin Army Hospital/VDC/09-Other Files/Upload Folder/" (GETVAR 'DWGNAME)))

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...