VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Suppress "save changes" dialog?

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
424 Views, 8 Replies

Suppress "save changes" dialog?

How can I suppress the "save changes" dialog?

I'm opening each drawing in single doc mode, prep the
drawing and plot it. Before I can open the next drawing,
AutoCAD detects the setting changes and stops my batch
with the save changes dialog. Kinda' defeats the
whole purpose of a batch plot program!

Any help appreciated.

VB 6
AutoCAD 2000
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

Just a guess, but have you tried ThisDrawing.Save ?


"Marty" wrote in message
news:7DC87CC93C8B7F0D782BEB5682DC7083@in.WebX.maYIadrTaRb...
> How can I suppress the "save changes" dialog?
Message 3 of 9
Anonymous
in reply to: Anonymous

Use Document.Close ( ) method:

Call yourDocument.Close ( False )

"Marty" wrote in message
news:7DC87CC93C8B7F0D782BEB5682DC7083@in.WebX.maYIadrTaRb...
> How can I suppress the "save changes" dialog?
>
> I'm opening each drawing in single doc mode, prep the
> drawing and plot it. Before I can open the next drawing,
> AutoCAD detects the setting changes and stops my batch
> with the save changes dialog. Kinda' defeats the
> whole purpose of a batch plot program!
>
> Any help appreciated.
>
> VB 6
> AutoCAD 2000
>
>
>
>
>
>
Message 4 of 9
Anonymous
in reply to: Anonymous

Eric,

Sure, I could save the drawing...but I wanted to know if there is a
way to "turn off" the save changes dialog itself.


Eric Stewart wrote in message
news:CA19B995482F6A67CE3E3B3E6F9523DF@in.WebX.maYIadrTaRb...
> Just a guess, but have you tried ThisDrawing.Save ?
>
>
> "Marty" wrote in message
> news:7DC87CC93C8B7F0D782BEB5682DC7083@in.WebX.maYIadrTaRb...
> > How can I suppress the "save changes" dialog?
>
>
>
Message 5 of 9
Anonymous
in reply to: Anonymous

How would one go about doing that in Single doc mode? Documents.close doesnt work when SD is on.
Message 6 of 9
Anonymous
in reply to: Anonymous

Try to set variable "DBMODE" to 0 (Zero)
so the AutoCAD would think that there was nothing done in the drawing. and
doesn't give you the dialogbox.
Goodluck

"Marty" wrote in message
news:7DC87CC93C8B7F0D782BEB5682DC7083@in.WebX.maYIadrTaRb...
| How can I suppress the "save changes" dialog?
|
| I'm opening each drawing in single doc mode, prep the
| drawing and plot it. Before I can open the next drawing,
| AutoCAD detects the setting changes and stops my batch
| with the save changes dialog. Kinda' defeats the
| whole purpose of a batch plot program!
|
| Any help appreciated.
|
| VB 6
| AutoCAD 2000
|
|
|
|
|
|
Message 7 of 9
Anonymous
in reply to: Anonymous


I don't know why you have to stick with SDI.
It is pose some problem with  AutoCAD' SDI when doing automation in
AutoCAD.

 

If you have to go with SDI for some reason while
doing batch processing, you need start a new AutoCAD session, because
AcadDocument.Close ( ) method not only close the document, but also close the
AutoCAD session. So the ode should be like following:

   

    Dim aApp as
AutoCAD.AcadApplication

    Dim aDoc As
AcadDocument
    

    Do


        Set aApp
= New AutoCAD.AcadApplication
       
aApp.Visible = True
    

        'Set SDI to
True because your special reason
       
aApp.Preferences.System.SingleDocumentMode = True
   

        Set aDoc =
aApp.Documents.Open("yourFile.dwg")
    

        'Do something
here
       
   
    aDoc.Close False     'AutoCAD is also
closed


   

    Loop while an="Process
continue"
    
  

Since the AutoCAD sesion is on and off repeatedly, the batch processing
will take longer time than MDI. But due to Windows caching the last lauched
application, it is not that badly slow, now that you "have to" go with
SDI.

 

This code only works for VB program, not AutoCAD's VBA. For AutoCAD VBA,
you can only do such batch processing in MDI.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
How
would one go about doing that in Single doc mode? Documents.close doesnt work
when SD is on.
Message 8 of 9
Anonymous
in reply to: Anonymous

Frits,

Thanks for the help with the AsdkUnsupp2000.arx and type library. The
SetDbMod allowed me
to set the read only DBMOD system variable to 0 and make autocad think that
there were no
changes to the drawing database.
In case some one else needs it, here is what I ended up with:

... If Not AcadDoc.Saved Then
SetDbMod (0) 'suppress save
changes dialog box.
End If

... AcadDoc.Open (sFileName) 'open the next drawing in
the list.

Private Sub SetDbMod(Lvalue As Long)

Dim help As AsdkUNSUPP2000Lib.Application
Application.LoadArx ("AsdkUnsupp2000.arx")

Set help =
AcadApp.GetInterfaceObject("AsdkUnsupp2000.Application.1")
help.SetDbMod (Lvalue)

Application.UnloadArx ("AsdkUnsupp2000.arx")

Set help = Nothing

End Sub




Frits Blankenzee wrote in message
news:B255B88D77788BC3175EC1ED643EB8D1@in.WebX.maYIadrTaRb...
> Try to set variable "DBMODE" to 0 (Zero)
> so the AutoCAD would think that there was nothing done in the drawing. and
> doesn't give you the dialogbox.
> Goodluck
>
> "Marty" wrote in message
> news:7DC87CC93C8B7F0D782BEB5682DC7083@in.WebX.maYIadrTaRb...
> | How can I suppress the "save changes" dialog?
> |
> | I'm opening each drawing in single doc mode, prep the
> | drawing and plot it. Before I can open the next drawing,
> | AutoCAD detects the setting changes and stops my batch
> | with the save changes dialog. Kinda' defeats the
> | whole purpose of a batch plot program!
> |
> | Any help appreciated.
> |
> | VB 6
> | AutoCAD 2000
> |
> |
> |
> |
> |
> |
>
>
Message 9 of 9
Anonymous
in reply to: Anonymous

Norm,

Thanks for the response.

 

I've found it to be faster to open and close one
drawing at a time, like autocad 14 does, than to open

multiple windows. Also, I don't think autocad will
be very stable after you've opend 300+ windows. Unless you close each
one...

which is kinda' what SDI mode allows you to do
without managing the documents collection further.

 

I can manage the documents collection upon start up
in order to set the SDI mode. From there I keep the application

object and rebuild only the doc object for the
active (next opened) drawing. The only problem with this method was that

when I modified the
plot settings of each drawing, it flagged the autocad database to save the
changes. 

 

Frits was kind enough to show me a method using the
AsdkUnsupp2000.arx  and type library that lets my automation

continue without interupption. (REF: 11:20 am
post)

 

Thanks again for everyone's interest.

 


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">


I don't know why you have to stick with SDI.
It is pose some problem with  AutoCAD' SDI when doing automation in
AutoCAD.

 

If you have to go with SDI for some reason while
doing batch processing, you need start a new AutoCAD session, because
AcadDocument.Close ( ) method not only close the document, but also close the
AutoCAD session. So the ode should be like following:

   

    Dim aApp as
AutoCAD.AcadApplication

    Dim aDoc As
AcadDocument
    

    Do


        Set
aApp = New AutoCAD.AcadApplication
       
aApp.Visible = True
    

        'Set SDI to
True because your special reason
       
aApp.Preferences.System.SingleDocumentMode = True
   

        Set aDoc =
aApp.Documents.Open("yourFile.dwg")
    

        'Do
something
here
       
   
    aDoc.Close False     'AutoCAD is also
closed


   

    Loop while an="Process
continue"
    
  

Since the AutoCAD sesion is on and off repeatedly, the batch processing
will take longer time than MDI. But due to Windows caching the last lauched
application, it is not that badly slow, now that you "have to" go with
SDI.

 

This code only works for VB program, not AutoCAD's VBA. For AutoCAD VBA,
you can only do such batch processing in MDI.

 


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
How
would one go about doing that in Single doc mode? Documents.close doesnt
work when SD is on.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost