Hi,
My requirement is migrating a desktop application from .vbp to .net.
Present code in vb is using ActiveX object to launch the autocad application and insert blocks and deal with the block attributes. The major existing project is to use the existing drawing blocks in specific path and modify and replace them.
Now while migrating it to .net which is the optimized way(recommended waY) to implement the above mentioned functionality, ActiveX or Autocad .Net API?
Please suggest a viable solution.
Solved! Go to Solution.
Solved by kdub_nz. Go to Solution.
Solved by _gile. Go to Solution.
Hi,
The .NET API is more powerfull but it cannot be directly used as stand-alone executable (exe). See this topic.
Can you please provide examples of using ActiveX Interop in C# other than launching autocad application ? For Example: InsertBlock Method(ActiveX)
Is there any possibility of Deprecating ActiveX in future?
As Microsoft might stop supporting VB in future?
@apoorva_jukanti a écrit :
Can you please provide examples of using ActiveX Interop in C# other than launching autocad application ? For Example: InsertBlock Method(ActiveX)
If you absolutely want to use ActiveX Interop in a .NET plugin (which most AutoCAD .NET developers deprecate), you can simply get the the AcadApplication object from the Application.AcadApplication property.
var acadApp = (AcadApplication)Application.AcadApplication;
var thisDrawing = acadApp.ActiveDocument;
var blockRef = thisDrawing.ModelSpace.InsertBlock(Point3d.Origin.ToArray(), blockName, 1.0, 1.0, 1.0, 0.0);
No, I would like to use .Net API.
But, My requirement is launching autocad from .net (which can be done only using ActiveX) and then use the existing .dwg from a folder and modify them.
Can I use ActiveX object for launching Autocad and then use .Net api for modifying the drawing ?
@apoorva_jukanti a écrit :
No, I would like to use .Net API.
But, My requirement is launching autocad from .net (which can be done only using ActiveX) and then use the existing .dwg from a folder and modify them.
Can I use ActiveX object for launching Autocad and then use .Net api for modifying the drawing ?
You can use the same "ConnectToAcad" method of the example in this topic from a stand-alone executable (without the CommandMethodAttribute).
if I install the latest autocad 2025 nuget, i will be able to use lower versions of autocad also right?
@apoorva_jukanti a écrit :
if I install the latest autocad 2025 nuget, i will be able to use lower versions of autocad also right?
No. You have to install the package corresponding to the targeted AutoCAD version.
@apoorva_jukanti wrote:it shows it does not support
//
the wording is "provide support"
That means that nuget won't answer questions about the files provided . . . which I think is typical, they just push the files provided by their clients.
sort of like : don't complain to the postman about the bills you get in the mail.
// Called Kerry in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
Sometimes the question is more important than the answer.
class keyThumper<T> : Lazy<T>; another Swamper
Is there a way, I can support all versions of autocad? using the AutoCAD.NET.Interop NuGet in my c# code
Can you please provide nuget that supports .net framework4.8 and autocad 2025
Judging by the questions you asked here and in the other forum (ObjectARX), it seems to me that you are probably not very familiar with AutoCAD programming and the various types of AutoCAD APIs that could be used in different scenarios/application types.
You might as well provide some detailed description of what type of application you want to develop, some business requirements/workflows...because these things decide if your goal is doable, and if yes, what AutoCAD API should be used. At least people do not have to keep guessing an answer you really want to hear.
Norman Yuan
Yes, you can use late binding and dynamic coding styles, this will eliminate the need for hard references.
Can't find what you're looking for? Ask the community or share your knowledge.