Hi all,
I am trying to use this bit of code to run the overkill command silently in the background. I can't use SendStringToExecute because it does not execute synchronously. After you enter "All" in the autocad command line and select the objects a dialog appears each time the command is run, I would also want to suppress this dialog.
Dim rb As New ResultBuffer
rb.Add(New TypedValue(5005, "_.OVERKILL"))
acedCmd(rb.UnmanagedObject)
rb = New ResultBuffer
rb.Add(New TypedValue(5005, "ALL"))
acedCmd(rb.UnmanagedObject)
rb = New ResultBuffer
rb.Add(New TypedValue(5005, vbLf))
acedCmd(rb.UnmanagedObject)
rb = New ResultBuffer
rb.Add(New TypedValue(5005, vbLf))
acedCmd(rb.UnmanagedObject)
rb = New ResultBuffer
rb.Add(New TypedValue(5005, vbLf))
acedCmd(rb.UnmanagedObject)
Thanks in advance,
-Ted
Hi Tony,
This would be for release 2012 and later. Testing on 2012
Hi and thanks Gile. Are you missing an Imports statement? I am getting 'Func' is ambiguous in namespace System?
It will build for me and maybe go to project properties and uncheck it from imported namespaces and see if using a importing statement helps or maybe load up the project.
You might have to do a repair on framework.
http://msdn.microsoft.com/en-us/library/8f0k13d2.aspx
You could also look at results from Gacutil.exe to help find problems
Quote
It will build for me and maybe go to project properties and uncheck it from imported namespaces and see if using a importing statement helps or maybe load up the project.
You might have to do a repair on framework.
http://msdn.microsoft.com/en-us/library/8f0k13d2.aspx
You could also look at results from Gacutil.exe to help find problems
Hi Jeff,
Thanks for the suggestions, if you look at the code I posted I did try to fully qualify the name but still getting the ambiguous error.
System.Func should be the fully qualified name right?
Do you think there could be an issue with the .NET 4.0 framework installed on my machine since I created an empty project and it still won't compile?
Edit:
I tried to also create a C# project using the AutoCAD wizard then created a class using Tony's example. Still getting the same error.
Edit:
Looking at the error message close it looks like there is a reference to a file in the AutoDesk folder to System.Core.DLL. What is this, do I need it?
This is weird, when I rename the System.Core.dll file in C:\Program Files\Autodesk\AutoCAD Mechanical 2012 and then start AutoCAD it regenerates this file. On starting also says please wait while windows configures AutoCAD each time this file is not present. I tried resetting Settings to Default then renaming this file but same behavior.
I also opened acad.exe.config in notepad and searched for System.Core, nowhere to be found.
Edit: It seems like this file is getting referenced when using AutoCADs wizard. If I create an empty Class Library and reference the AutoCAD dlls then create Tony's Editor Extension Method class I don't get these errors. Not sure if there would be a way to fix an older project to not reference this System.Core file in the AutoCAD install folder. I cannot find the reference to this dll anywhere in the project.
Does anyone else who has an install of AutoCAD 2012 see the same behavior?
Thanks Tony,
My project is targeting .NET 4.0.
What are you asking is installed into my acad folder?
No it is not. The project is not located locally on my machine, it is located on a server.
Have you tried running your app from the local system, and if so, is the result the same?
QuoteHave you tried running your app from the local system, and if so, is the result the same?
I copied the project folder locally and same result when open in VS
It seems like it is the wizard that is referencing the System.Core dll from the AutoCAD folder because if I create a new project and reference the AutoCAD dlls (AcDbMgd and AcMgd) manually I didn't have the same issue of ambiguity. But if I use the wizard I see this issue.
At this point I just want to not reference the System.Core dll from the AutoCAD folder because I shouldn't even need a reference to it and I don't want to have to recreate the project because I have a lot of forms I would need to recreate and code to make sure is correct again.
This is starting to get frustrating because I can't find the reference anywhere and I don't see why it would be referenced in the first place with the wizard?
I'm not going to use the wizard anymore, but this VS studio project was one of my earlier ones so I used Autodesk's wizard. I really don't want to have to recreate the entire project if it's not necessary.
... it is like tits on a bull.Thanks Tony.
I think I found a workaround that appears to work so I don't have to rebuild my project, although I would really like to incorporate Tony's Extension Method :-(Code - Visual Basic: [Select]
Dim curAcadDoc As Object = Application.DocumentManager.MdiActiveDocument.AcadDocument curAcadDoc.SendCommand("._-OVERKILL" & vbLf) curAcadDoc.SendCommand("_ALL" & vbLf) curAcadDoc.SendCommand(vbLf) curAcadDoc.SendCommand(vbLf)
Edit:
I lied, this still does not execute synchronously. Back to the drawing board.