How can I get the connected devices ID at the end of the wire?

How can I get the connected devices ID at the end of the wire?

nur91m
Advocate Advocate
927 Views
1 Reply
Message 1 of 2

How can I get the connected devices ID at the end of the wire?

nur91m
Advocate
Advocate

I'm trying to get the devices ID at the end of the wire. I looked for wire class methods and parameters, but couldn't find anything. If someone knows please help me to solve this problem.

0 Likes
928 Views
1 Reply
Reply (1)
Message 2 of 2

Aaron.Lu
Autodesk
Autodesk
The Wire has property Wire.ConnectorManager, you can get Connectors from it, and check the connector's AllRefs property to get the connected connectors, then from those connectors, you can get the connected elements.

this can be applied to all MEP related system, including Piping and ducting.

foreach (Connector connector in wire.ConnectorManager.Connectors)
{
if (connector.IsConnected)
{
foreach (Connector con in connector.AllRefs)
{
var connectedElement = con.Owner; //here it is
}
}
}


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes