- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to access the Parts List created by Autocad Mechanical.
It can be done manually in Autocad Mechanical , but I'd like to automate it. Link to manually extract the parts list
I found this code in VBA, which I could convert to C#, but i do not have AtuoDesk McadAuto Type Library, even though I have Autocad Mechanical Installed. I have tried to find it, but have had no success.
I looked at the Developer Guide for AutoCAD Mechanical, but this did not seem to help
The code below finds the parts list in the attached drawing file, but i cannot find what to do to read the parts list.
DBObjectCollection objs = new DBObjectCollection();
Document doc = AcadApp.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
ObjectId Id;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt;
bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btr;
btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord;
ObjectIdCollection ids = new ObjectIdCollection();
foreach (ObjectId id in btr)
{
if (id.ObjectClass.DxfName == "ACMPARTLIST")
{
// code to read data from parts list
}
}
}
The ACMPARTLIST looks like a table, but it cannot be extracted using the autocad command TableExport, or DataExtraction.
I have tried other suggestions. This one extracts tables, but ACMPARTLIST is not a table.
http://forums.autodesk.com/t5/net/extracting-bom-from-autocad-using-c/m-p/3873852#M34623
Do i need the McadAuto.dll so I can access the BOM, or am i missing something else?
Solved! Go to Solution.