3dwannab Posted April 19, 2023 Posted April 19, 2023 I have this lisp which saves out to 3 different file types. I edit the dwt and then it saves out to each. I want the dwt to have a description like below but this line sometimes gets stuck at the "Y" command. ; What this does ; Saves the dwt file out to a dwg and Standards file ; Written on 2023.02.10 by 3dwannab ; Issues: ; The save as template sometimes doesn't work. Is there a vla method to do this? (defun c:Save_DWT_to_Templates (/) (setvar "FILEDIA" 0) (c:PQ) ;; Purge the drawing before saving (command "_SAVEAS" "LT2018" "" "Y") (command "_SAVEAS" "Standards" "" "Y") (setvar "FILEDIA" 1) (command "_.close" "_Y") ; (command "_SAVEAS" "Template" "" "Y" "M" "Company name here (Compatible with Sheet Sets)") ) ; (c:Save_DWT_to_Templates) Quote
Steven P Posted April 19, 2023 Posted April 19, 2023 VLA Save as (vla-SaveAs (vla-get-ActiveDocument (vlax-get-acad-object)) (strcat (getvar "dwgprefix") "dwgname" ".dwg") version) where version is the version code such as "ac2018_dwg" - you can get this by opening the DWG with a text editor (notepad) and the first word is this and depends on the version it is saved as Getting stuck on 'Y' if the drawing exists? (if (= 1 (getvar "dwgtitled")) ;;if existing drawing (progn ;;Stuff if exiting draswing ) ; end progn (progn ;;Stuff if new drawing ) ; end progn ) ; end if Quote
Steven P Posted April 19, 2023 Posted April 19, 2023 Might be better for you as well - resets system variables to what they were (in case filedia started at something other than 1 ) (setq vars '("CMDECHO" "FILEDIA")) ;;3 lines to disable command promts and echo (setq old (mapcar 'getvar vars)) ;; save what the system variables above are (mapcar 'setvar vars '(0 0)) ;; Set above system variables to 0 (or whatever) --- CODE --- (mapcar 'setvar vars old) ;;reset system variables Quote
3dwannab Posted April 20, 2023 Author Posted April 20, 2023 (edited) Thanks, how would I save it to a DWT file with a description using the vla method and set it to metric? When I open the DWT file in notepad the version is AC1032. Edited April 20, 2023 by 3dwannab Quote
Steven P Posted April 20, 2023 Posted April 20, 2023 Try this link: https://help.autodesk.com/view/OARX/2023/DEU/?guid=GUID-ED0D0B02-25FC-4ED2-9DEE-2B0C9AA9416A Though to be honest I don't often make template files so don't have a LISP for it - try it and see what happens 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.