Jump to content

Recommended Posts

Posted

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)

 

Posted

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

 

Posted

 

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

 

Posted (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 by 3dwannab

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