I have a program in C# where i am trying to access a sub-object which is of type Connectors/fasteners.
In a drawing, I have an object with class (PnPClassname) P3dConnector, and when I click on it's red circle with <ctrl> pressed, I access an object with class (PnPClassname) BoltSet. I have added the event oDatabase.ObjectModified, but this only access the P3dConnector-object, not the BoltSet-object. See the image and attached file.
How can i access this sub-object? I have tried to loop through prompted result set using SelectAll. The P3dConnector-object is listed but not the BoltSet-object.
I am able to access the object by using following code:
using (Transaction tx = objId.Database.TransactionManager.StartTransaction())
{
DBObject dbObject = tx.GetObject(objId, OpenMode.ForRead);
Autodesk.ProcessPower.PnP3dObjects.Connector Conn = tx.GetObject(objId, OpenMode.ForRead) as Autodesk.ProcessPower.PnP3dObjects.Connector;
if (Conn != null)
{
foreach(Autodesk.ProcessPower.PnP3dObjects.SubPart sp in Conn.AllSubParts)
{
MessageBox.Show(sp.GetType().ToString());
}
}
}
But the Conn.Id is 0. How do i get the object from a sub part?
Can't find what you're looking for? Ask the community or share your knowledge.