.NET

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

Suppress Messages

364 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 (356 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 (350 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 (340 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 (307 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 (288 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 (271 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 (223 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
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!