@Anonymous wrote:
Sorry, let me just summarize my last question so you don't have to read everything. Code is working, just need to know how to save as in the last line. I'm saving from one directory to the specific one below, I want to use the existing drawing number that I will currently be in at all times. There are many different codes to grab this, but I'm not sure how to tie it in.
(defun c:test ()
(command "_.purge" "_all" "*" "_no"
"_.setbylayer" "_all" "" "_yes" "_yes"
"_.layer" "_color" "253" "*" ""
"_.audit" "_yes"
"_.saveas" "2013" "S:\ENGINEERING\JOBS\16-006 GM Ramos\DRAWINGS\GK\GK XREF\" "dwgname")
)
As you where close, i'll try to explain what exactly is wrong here:
"_.saveas" "2013" "S:\ENGINEERING\JOBS\16-006 GM Ramos\DRAWINGS\GK\GK XREF\" "dwgname"
There are 2 problems with this piece of code:
1: Each argument given to the command needs to be inside 1 string. Your path & "dwgname" are 2 arguments, not 1. This way only the path is used as filename and the "dwgname" would be to answer any next prompt, if there where any, otherwise it will be seen as a next command. You need to join them into 1 string.
2: Although typing variable names at the commandline works to get their value, this isn't true for lisp. You need to retrieve the value with the GETVAR command. (getvar "dwgname")
So, to suply a correct path use: (strcat "your path" (getvar "dwgname"))
This will join the 2 strings (path & dwgname) together into 1 string = 1 argument for filename.