Jump to content

Recommended Posts

Posted

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)
1w11
closemdi
open
"C:\Documents and Settings\sseyler\Local Settings\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Template\ANSI C TITLE BLOCK.DWG"
(acad-push-dbmod)
1w11
closemdi
open
"C:\Documents and Settings\sseyler\Local Settings\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Template\ANSI D TITLE BLOCK.DWG"
(acad-push-dbmod)
1w11
closemdi

closemdi:

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 If
End 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?

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