Change the panel a connector is connected to

Change the panel a connector is connected to

stever66
Advisor Advisor
526 Views
2 Replies
Message 1 of 3

Change the panel a connector is connected to

stever66
Advisor
Advisor

I've spent a few hours searching, and trying different things, but I can't seem to get or set the Panel that a device is connected to.

 

For example, if I select a receptacle, I want to be able to see and change the Panel that receptacle is connected to.

 

I've managed to get the connector for the selected item and assign it to "c".  But I cant get any farther.

 

I've tried:

 

MEPFamilyConnectorInfo famConnInfo = c.GetMEPConnectorInfo () as MEPFamilyConnectorInfo ;
        	
        	
        	ParameterValue param = famConnInfo.GetConnectorParameterValue( new ElementId(BuiltInParameter.RBS_ELEC_CIRCUIT_PANEL_PARAM));
        	TaskDialog.Show("RBS ELEC CIRCUIT PANEL PARAM:", param.ToString ());

I can't seem to convert the ParameterValue param to anything useful.  Trying to use .ToString() causes an error.

 

 

 

 

0 Likes
527 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk

What is the parameter data type?

 

Revit manages some data types in parameters that do not fit into the int, double, ElementId and string classes supported by the Revit API, and are therefore inaccessible.

 

What does RevitLookup show?

 

Is the panel the host of the device?

 

For many elements, the host can only be set by the constructor, when creating a new element, and not modified later.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 3

stever66
Advisor
Advisor

Let me answer your questions in reverse;


@jeremytammik wrote:

For many elements, the host can only be set by the constructor, when creating a new element, and not modified later.

 


OK, for now I'll simplify the question to "how do I read the values for the connected panel and circuit number?"


@jeremytammik wrote:

 

Is the panel the host of the device?

 


No, the connector is hosted to a device, like a receptacle.  The connector (and the receptacle) are circuited to the panel via a circuit.  The circuit should contain information including the connected panel name and the circuit number.

 


@jeremytammik wrote:

What is the parameter data type?

 

Revit manages some data types in parameters that do not fit into the int, double, ElementId and string classes supported by the Revit API, and are therefore inaccessible.

 

What does RevitLookup show?


Well, Revit Lookup shows that parameter is associated with the host (the receptacle) and not the actual connector.  It shows it as an Instance Parameter of a "String/Text" type in the "Element.Parameters" collection.   

 

So it seems like I need to read the parameter from the receptacle, and not the connector.  Does that sound like I'm on the right track?


But what happens when a device has more than one connector?  A single parameter can't hold two different panel names or circuit numbers?

 

0 Likes