Author Topic: Close Drawing question in lisp  (Read 5234 times)

0 Members and 1 Guest are viewing this topic.

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Close Drawing question in lisp
« 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
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Close Drawing question in lisp
« Reply #1 on: July 14, 2004, 09:30:19 AM »
Are you working in MDI mode?
TheSwamp.org  (serving the CAD community since 2003)

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Close Drawing question in lisp
« Reply #2 on: July 14, 2004, 09:31:35 AM »
Yes
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Close Drawing question in lisp
« Reply #3 on: July 14, 2004, 09:33:46 AM »
So you want to close one of the _other_ dwg's?
TheSwamp.org  (serving the CAD community since 2003)

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Close Drawing question in lisp
« Reply #4 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)
)
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

SMadsen

  • Guest
Close Drawing question in lisp
« Reply #5 on: July 14, 2004, 09:45:33 AM »
(command "VBASTMT" "ThisDrawing.Close(FALSE)")
could be a quit workaround.

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Close Drawing question in lisp
« Reply #6 on: July 14, 2004, 11:01:35 AM »
That works. Thanks for the help.
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

SMadsen

  • Guest
Close Drawing question in lisp
« Reply #7 on: July 14, 2004, 11:04:57 AM »
Oops typo .. 'quick' not 'quit'

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Close Drawing question in lisp
« Reply #8 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 :-/
TheSwamp.org  (serving the CAD community since 2003)

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Close Drawing question in lisp
« Reply #9 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.
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Close Drawing question in lisp
« Reply #10 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?
TheSwamp.org  (serving the CAD community since 2003)

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Close Drawing question in lisp
« Reply #11 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"
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023