seyven 发表于 2022-7-6 17:24:46

acad-push-dbmod in script

So I'm having a small problem at the junction of LISP, VBA, scripting and (acad-push-dbmod).
 
My company makes heavy use of scripting, through a external application that creates a script file to apply to multiple drawings. This is used to make large sections of drawing package, change revision levels and plot packets. I have been given the task of making a uniform, base set of the template files that our application uses. The more complex tasks have actually been fairly simple for me to standardize.
 
At this present time, I'm trying to deal with our plot templates. I want it to open the drawing, plot the drawing, and then close it without saving. But it needs to work in both MDI and SDI mode.
 
Following is a sample output script file. We already have (acad-pop-dbmod) in our standard acad2004doc.lsp file. When I execute this script by copying and pasting it into my command window, it runs flawlessly. However, when I attempt to run this .scr via the script command, it fails out, asking if I want to discard my changes on the first drawing.
 
Included are two custom lisp defined commands, which are vbarun calls to VBA macros. The first, 1w11 is an intelligent and automated plot command which requires no user input. It alters the page layout and plots the drawing. In addition to the call from acad2004.doc, this macro beings with
activedocument.sendcommand "(acad-pop-dbmod) " and ends with
activedocument.sendcommand "(acad-push-dbmod) "the much simpler closemdi is included after the script code.
 

open"C:\Documents and Settings\sseyler\Local Settings\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Template\ANSI B TITLE BLOCK.DWG"(acad-push-dbmod)1w11closemdiopen"C:\Documents and Settings\sseyler\Local Settings\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Template\ANSI C TITLE BLOCK.DWG"(acad-push-dbmod)1w11closemdiopen"C:\Documents and Settings\sseyler\Local Settings\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Template\ANSI D TITLE BLOCK.DWG"(acad-push-dbmod)1w11closemdiclosemdi:

Sub CloseMDI()   If Not Application.Preferences.System.SingleDocumentMode Then       If Documents.Count > 1 Then         ActiveDocument.Close False         For Each Ite In Documents               Ite.Activate               Exit For         Next       End If   Else       'MsgBox "SDI"       'ActiveDocument.SendCommand "(acad-pop-dbmod) "   End IfEnd Sub
 
So, would anyone here have any ideas as to why this works by hand but not in script? Or more directly, a way to put 0 on the stack so that (acad-pop-dbmod) will ALWAYS clear the saved state of a drawing?
页: [1]
查看完整版本: acad-push-dbmod in script