New Member
Posts: 1
Registered: ‎07-20-2011
Message 1 of 2 (227 Views)

Convert a Wall (AEC_WALL) to an Solid3D Object

227 Views, 1 Replies
11-24-2013 10:29 AM



Can someone explain me how I can change an AEC Wall (AEC_WALL) to an Solid3D Object. I found out that I can extract all Bodies from a Wall with "GetComponentBodies" function, but I do not know how to get this to an Solid3D Object.


Dim wall AsWall = TryCast(trans.GetObject(obj, OpenMode.ForRead), Wall)

Dim bodyColl As New BodyCollection

wall.GetComponentBodies(bodyColl,True, False, True, True, True, True, True)



I know that there is an Autodesk Architectur Command "AECCONVERTTO3DSOLIDS" --> dies is the Command what i need --> but i need the command for .NET.


I hope, anyone can Help me.



ADN Support Specialist
Posts: 328
Registered: ‎03-05-2010
Message 2 of 2 (143 Views)

Re: Convert a Wall (AEC_WALL) to an Solid3D Object

12-13-2013 12:16 AM in reply to: mike_mair


Hi Mike,


You can write out the body components of AEC wall to *.sat file to the disk. Then read in this file using the Autodesk.AutoCAD.DatabaseServices.Body.AcisIn(fileName). The Body class in AutoCAD .NET is a 3D solid entity.



Here is the full code to convert the wall to 3D solid.




[Autodesk.AutoCAD.Runtime.CommandMethod("w2b", "w2b", Autodesk.AutoCAD.Runtime.CommandFlags.Modal)]
public void ConvertWallToAcDbBody()
Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;

PromptEntityOptions opts = new PromptEntityOptions("\nPick a wall: ");
PromptEntityResult results = null;

results = editor.GetEntity(opts);
ObjectId id = results.ObjectId;

Database db = Application.DocumentManager.MdiActiveDocument.Database;

TransactionManager tm = db.TransactionManager;
Transaction trans = tm.StartTransaction();

Wall w = trans.GetObject(id, OpenMode.ForRead) as Wall;
BodyCollection bc = new BodyCollection();
w.GetComponentBodies(out bc, true, true, true, true, true, true, true);

BlockTable bt = (BlockTable)tm.GetObject(db.BlockTableId, OpenMode.ForRead, false);
BlockTableRecord btr = (BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);

String fileName = @"c:\test\mysat.sat";
foreach (Autodesk.Aec.Modeler.Body b in bc)


DBObjectCollection collection = Autodesk.AutoCAD.DatabaseServices.Body.AcisIn(fileName);

foreach(DBObject obj in collection)
trans.AddNewlyCreatedDBObject(obj, true);






Hope this helps,


Joe Ye
Developer Technical Services
Autodesk Developer Network
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.