.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Suppress Messages

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
amitnkukanur
887 Views, 7 Replies

Suppress Messages

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

 

Senior Software Engineer
7 REPLIES 7
Message 2 of 8
adadnet
in reply to: amitnkukanur

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

Message 3 of 8
amitnkukanur
in reply to: amitnkukanur

But How do i control these issues through code?

 

With Warm Regards

Amit

Senior Software Engineer
Message 4 of 8
adadnet
in reply to: amitnkukanur

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)

Message 5 of 8
amitnkukanur
in reply to: amitnkukanur

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

 

With Warm Regards

Amit

Senior Software Engineer
Message 6 of 8
Hallex
in reply to: amitnkukanur

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
Message 7 of 8
amitnkukanur
in reply to: amitnkukanur

Thanks Hallex, this logic resolved the bug.

Thanks a lot Hallex

Senior Software Engineer
Message 8 of 8
Hallex
in reply to: amitnkukanur

You're quietly welcome

Happy coding Smiley Happy

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost