Explode

Explode

amitnkukanur
Collaborator Collaborator
2,355 Views
9 Replies
Message 1 of 10

Explode

amitnkukanur
Collaborator
Collaborator

Hello, I am doing a customization in AutoCAD2013 using C# as development language. The Application runs outside AutoCAD and is a COM Application. However i am stuck at explode option currently i am sending command to AutoCAD to select all and then explode. This works some times and some times doesn't work hence results are improper

 

Is there any possibility to explode using COM interface.

 

rgds

Amit

Senior Software Engineer
0 Likes
Accepted solutions (1)
2,356 Views
9 Replies
Replies (9)
Message 2 of 10

Norman_Yuan
Mentor
Mentor

Yes, COM API does provide "Explode" functionality. All of the explode-able COM objects (AcadBlockReference, AcadLWPolyline, AcadRegion...) have a method Explode().

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 10

amitnkukanur
Collaborator
Collaborator

Hi Norman Yuan,

 

Thanks for reply.

 

Actually this is my below code which i did earlier for Explode, It is not exploding the the way Explode command does.

 

 

foreach (AcadEntity acadEnt inacApp.ActiveDocument.Database.ModelSpace)

{

AcadBlockReference acadBlkRef = null;

 

if (acadEnt.ObjectName.Equals("AcDbBlockReference"))

{

acadBlkRef = acadEnt as AcadBlockReference;

 

//acadBlkRef.Delete();

acadBlkRef.Explode(); }

}

acApp.ActiveDocument.Save();

 

How should i explode all data present in drawing, please feel free to change the logic.

 

 

rgds

Amit

Senior Software Engineer
0 Likes
Message 4 of 10

Norman_Yuan
Mentor
Mentor
Accepted solution

Well, Explode() method in the COM API does not equal to AutoCAD command "EXPLODE".

 

The Explode() method simply retuen an array of AcadObjects that makes up the entity "being exploded", which itself remains unchanged after calling the Explode() method.

 

So, if your intention is to do the same as AutoCAD's EXPLODE command, after you call the Explode() method, which generates a set of individual entities, you need to erase the entity being exploded.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 5 of 10

Anonymous
Not applicable
does COM add all the AcadObjects that make up the entity into the Database, or should we have to provide some codes to add them into database ?
0 Likes
Message 6 of 10

Norman_Yuan
Mentor
Mentor

No, in COM API, there is no Database/Transaction concept. The AcadObjects generated by calling Explode() method are already in drawing database when the call ends.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 7 of 10

amitnkukanur
Collaborator
Collaborator
Hi Norman Yuan,

Thanks for reply and i will work on the idea which you provided. Thanks for replying.

rgds
Amit
Senior Software Engineer
0 Likes
Message 8 of 10

Anonymous
Not applicable
ok, thanks norman, can you recommand some resources of using COM ?
0 Likes
Message 9 of 10

Norman_Yuan
Mentor
Mentor

If you ever did AutoCAD VBA development, you would know to go to AutoCAD's VBA editor, open "Object Browser", select any Object/property/Mothd in Object Browser and click "?" buttom to open VBA Help. In comparison to .NET documentation, COM API is fairly well documented in VBA help, almost every Object/Method/Property comes with sample code.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 10 of 10

Anonymous
Not applicable
ok, that's very helpful, thank you!
0 Likes