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
Solved! Go to Solution.
Solved by amitnkukanur. Go to Solution.
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%20.NET%20Developer's%20Guide/index.html (under 'set and return system variables')
hope this is of use
But How do i control these issues through code?
With Warm Regards
Amit
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)
My current code is using the concept of Latebinding and Multithreading, will this work if i incorporate this logic.
With Warm Regards
Amit
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'~
Thanks Hallex, this logic resolved the bug.
Thanks a lot Hallex
You're quietly welcome
Happy coding
~'J'~
Can't find what you're looking for? Ask the community or share your knowledge.