Code Red > AutoLISP (Vanilla / Visual)
VLisp Question
Craig:
Is there a way in vlisp to save a dwg file. I know in Auotlisp you can't use something like (command ".save" filename). Is there something in vlisp that will allow this? Basically what I'm doing is wanting to select a button and it store the drawing I am working on into another location, not the folder I am working out of. What I've started with so far is:
--- Code: ---(defun c:store ()
(setq name (getvar "dwgname"))
(setq project (substr name 1 5))
(setq path (strcat "h:/" project "/" name))
(command "_save" (strcat "h:/" project "/" name)) <---I know this won't work
--- End code ---
I just wanted to show the last line of what I am wanting to get to with vlisp. If you input each line into our drawing here is the return:
--- Code: ---(setq name (getvar "dwgname"))
"03033MP1.dwg"
(setq project (substr name 1 5))
"03033"
(setq path (strcat "h:/" project "/" name))
"h:/03033/03033MP1.dwg"
--- End code ---
I can save the drawing taking a few extra lines of code creating a .bat file, but I really want to get away from batch filing. Any ideas?
Craig:
Will vl-file-copy let me do this? I can put in the dwg name variable and then the strcat path. Sumthin like
(vl-file-copy "filename" (strcat "h:/" project "/" name))
Think this would work?
daron:
vla-save should do the trick. Look it up under activex and vba reference.
Craig:
vla-save is not working and is not listed in the documentation. Not sure where I should be looking for this. I know little about Vlisp. The line of code (vla-save name (strcat "h:/" project "/" name)) does not work. Not sure on how to implement this
Mark:
needs more error checking
--- Code: ---;;; path = string
;;; c:\\temp\\ <-- needs ending '\\'
(defun cpCurdwg (path / fn dn nn)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq fn (vlax-get-property doc 'FullName)
dn (vlax-get-property doc 'Name)
nn (strcat path dn)
)
(if (vl-file-copy fn nn)
(princ "\nFile copied...")
(princ "\nNo file copied...")
)
(princ)
)
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version