TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: V-Man on July 14, 2004, 09:25:06 AM

Title: Close Drawing question in lisp
Post by: V-Man on July 14, 2004, 09:25:06 AM
How do you get around the nagging question "Really want to discard all changes to drawing? <N>

in lisp

(command ".close" "Y") ;; does not work
Title: Close Drawing question in lisp
Post by: Mark on July 14, 2004, 09:30:19 AM
Are you working in MDI mode?
Title: Close Drawing question in lisp
Post by: V-Man on July 14, 2004, 09:31:35 AM
Yes
Title: Close Drawing question in lisp
Post by: Mark on July 14, 2004, 09:33:46 AM
So you want to close one of the _other_ dwg's?
Title: Close Drawing question in lisp
Post by: V-Man on July 14, 2004, 09:35:54 AM
Yes, I have a routine that will wblock out the currect drawing to create a clean drawing. I then want to close the drawing and DO NOT save changes.

Code: [Select]

(defun C:Cleanwblock ()
   (princ "\nwMake a New Clean Drawing")
   (setvar "FILEDIA" 0)
   (setvar "CMDDIA" 0)
   (setvar "CMDECHO" 1)
   (command "-layer" "on" "*" "thaw" "*" "unlock" "*" "")
   (command ".regen")
   (if (setq jset (ssget "x"))
      (progn
         (setq jdwg (getvar "DWGNAME"))
         (setq jpath (getvar "DWGPREFIX"))
         (setq jfile (strcat jpath jdwg))
         (if (findfile jfile )
            (command "-wblock" jfile "Y" "" "0,0,0" "p" "" "N")
            (command "-wblock" jfile "" "0,0,0" "p" "" "N")
         )
      )
      (princ "\nNo Entities to Wblock")
   )
   (setvar "FILEDIA" 1)
   (setvar "CMDDIA" 1)
   (command "close" jfile) ;;<----This does not work..
   (princ)
)
Title: Close Drawing question in lisp
Post by: SMadsen on July 14, 2004, 09:45:33 AM
(command "VBASTMT" "ThisDrawing.Close(FALSE)")
could be a quit workaround.
Title: Close Drawing question in lisp
Post by: V-Man on July 14, 2004, 11:01:35 AM
That works. Thanks for the help.
Title: Close Drawing question in lisp
Post by: SMadsen on July 14, 2004, 11:04:57 AM
Oops typo .. 'quick' not 'quit'
Title: Close Drawing question in lisp
Post by: Mark on July 14, 2004, 11:38:33 AM
Quote from: dvarino
Yes, I have a routine that will wblock out the currect drawing to create a clean drawing. I then want to close the drawing and DO NOT save changes.

Code: [Select]

(defun C:Cleanwblock ()
   (princ "\nwMake a New Clean Drawing")



- dvarino

I don't get it!!
When I run this I get a dwg with nothing in it :-/
Title: Close Drawing question in lisp
Post by: V-Man on July 14, 2004, 11:50:31 AM
Quote

I don't get it!!
When I run this I get a dwg with nothing in it :-/


It works fine here.
Title: Close Drawing question in lisp
Post by: Mark on July 14, 2004, 11:59:26 AM
Quote from: dvarino
Quote

I don't get it!!
When I run this I get a dwg with nothing in it :-/


It works fine here.

Ok. What do you get? What version of ACAD are you running this in?
Title: Close Drawing question in lisp
Post by: V-Man on July 14, 2004, 12:09:11 PM
Quote

Ok. What do you get? What version of ACAD are you running this in?



When I run the command it selects everything in the CAD file and wblocks it out on top of itself then the routine closes the file and DOES NOT save changes because if it did it would overwrite what I just wblocked and the drawing would be BLANK

.
Autocad Map5

Command: (getvar "acadver")
"15.06"