.NET

Reply
Mentor
242 Posts
16 Kudos
Registered: ‎12-15-2011
Post 1 of 8
Accepted Solution

Suppress Messages

384 Views, 7 Replies
08-21-2012 11:34 PM

Is there a way to suppress the message boxes given by autocad, such as Drawing file recovery. We are doing a project where this message stops execution of code every time

 

My current code is using the concept of Latebinding and Multithreading, will this work if i incorporate this logic.

 

With Warm Regards

Amit

Valued Contributor
95 Posts
1 Kudo
Registered: ‎11-15-2011
Post 2 of 8

Re: Suppress Messages

08-22-2012 01:19 AM in reply to: amitk_189

hi

 

with regards to drawing recovery at least, try setting the RECOVERYMODE system variable to 0 or 1:

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS1a91938...

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html (under 'set and return system variables')

 

hope this is of use

Mentor
242 Posts
16 Kudos
Registered: ‎12-15-2011
Post 3 of 8

Re: Suppress Messages

08-22-2012 04:49 AM in reply to: amitk_189

But How do i control these issues through code?

 

With Warm Regards

Amit

Valued Contributor
95 Posts
1 Kudo
Registered: ‎11-15-2011
Post 4 of 8

Re: Suppress Messages

08-22-2012 06:30 AM in reply to: amitk_189

sorry if my post wasn't clear or if i missunderstood; based on the section 'set and return system variables' of the developer's guide (2nd link):

 

Dim nMaxSort as Integer = Application.GetSystemVariable("RECOVERYMODE")

Application.SetSystemVariable("RECOVERYMODE", 1) 

 

as a result, "the Drawing Recovery window does not display automatically" (1st link).

 

(if what you're looking for is a way of programmatically handling [any] acad messagebox events, say on opening acad, i have to pass)

Mentor
242 Posts
16 Kudos
Registered: ‎12-15-2011
Post 5 of 8

Re: Suppress Messages

08-22-2012 09:09 PM in reply to: amitk_189

My current code is using the concept of Latebinding and Multithreading, will this work if i incorporate this logic.

 

With Warm Regards

Amit

*Expert Elite*
1,569 Posts
171 Kudos
Registered: ‎10-08-2008
Post 6 of 8

Re: Suppress Messages

08-23-2012 08:12 AM in reply to: amitk_189

Add this function

   

    Public Shared Sub SetVar(owner As Object, varname As String, value As Object)
        Dim args As Object() = New Object() {varname, value}
        owner.GetType().InvokeMember("SetVariable", Reflection.BindingFlags.InvokeMethod Or Reflection.BindingFlags.IgnoreCase, _
                        Nothing, _
                        owner, _
                        args)

    End Sub

  

Then inside your calling Sub add this line

after you have a got activedocument

 

       AcDoc = AcadApp.GetType.InvokeMember( _

        "ActiveDocument", BindingFlags.GetProperty,

Nothing, AcadApp, Nothing, Nothing)

            SetVar(AcDoc, "regenmode", 1)

 

Restore variable at the end of work with active document

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Mentor
242 Posts
16 Kudos
Registered: ‎12-15-2011
Post 7 of 8

Re: Suppress Messages

08-24-2012 03:12 AM in reply to: amitk_189

Thanks Hallex, this logic resolved the bug.

Thanks a lot Hallex

*Expert Elite*
1,569 Posts
171 Kudos
Registered: ‎10-08-2008
Post 8 of 8

Re: Suppress Messages

08-26-2012 11:24 AM in reply to: amitk_189

You're quietly welcome

Happy coding :smileyhappy:

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!