I have created a Autocad Plant3D test plug-In using C# . In this code, I have to access triangulated data of a pipe object.
It gets compiled, but at run time throws an exception as in attached image.
Database db = Application.DocumentManager.MdiActiveDocument.Database;
using (Transaction transaction = db.TransactionManager.StartTransaction())
{
BlockTableRecord btRecord = (BlockTableRecord)transaction.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForWrite);
foreach (ObjectId id in btRecord)
{
DBObject tDBObject = (DBObject)transaction.GetObject(id, OpenMode.ForWrite);
if (tDBObject is Pipe)
{
Pipe tpipe = tDBObject as Pipe;
tBrep = new Brep(tpipe); //Throws an exception on this line.
}
}
}
Please let me know where i am making a mistake and also, if any other way to access Pipe tessellation.