I'm trying to modify Block definitions in dwg files from an out-of-process app.
I can add entities to the block definition but only when I know the entity type in advance (e.g. block.AddLine() etc.).
What I mean is I need to copy entities from a source (e.g. another drawing) and add them to the block definition, without checking the entity type.
I notice there is no generic AcadBlock.Add() or AddObject() or AddEntity().
Would it be possible to do it at all?
Solved! Go to Solution.
Firts the bad news: 2004 does not support .NET API, you need 2005 at least, but that was almost experimental, so it's better to get a more modern version of AutoCAD. As for the block definition, you can check this: http://through-the-interface.typepad.com/through_t
I am using COM ActiveX quite successfully for 2004.
I saw Kean's article at his blog, it's not quite what I need.
I'm looking for a solution to the specific problem I mentioned.
Maybe the Autodesk people will see this and come forward.
You said 'first the bad news'.
OK. Where are the good news?
Not sure about if this helps,
try the quick code example,
just change file names and block name
to your suit
Awesome, Thank you. This is just what I'm looking for.
I wasn't aware of AcadDocument.CopyObjects().
All I have to do now is translet your VB code to C#.
In case it will be useful to anyone, here is a method, based on Hallex's code translated to C# Interop,
which performs a INSERT =.
Start with some of our most frequented solutions to get help installing your software.