.NET

Reply
Mentor
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 1 of 8 (372 Views)
Accepted Solution

Suppress Messages

372 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
FFlix
Posts: 95
Registered: ‎11-15-2011
Message 2 of 8 (364 Views)

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
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 3 of 8 (358 Views)

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
FFlix
Posts: 95
Registered: ‎11-15-2011
Message 4 of 8 (348 Views)

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
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 5 of 8 (315 Views)

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*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 6 of 8 (296 Views)

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
amitk_189
Posts: 242
Registered: ‎12-15-2011
Message 7 of 8 (279 Views)

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*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 8 of 8 (231 Views)

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
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.