Get Elbow's Min. and Max. Size values from a Pipe Type's routing preference.

Get Elbow's Min. and Max. Size values from a Pipe Type's routing preference.

ncircle_a4
Explorer Explorer
408 Views
2 Replies
Message 1 of 3

Get Elbow's Min. and Max. Size values from a Pipe Type's routing preference.

ncircle_a4
Explorer
Explorer

How to get and set the values of Min. Size and Max. Size of any elbow which is set as a rule in a pipe type's routing preference.
Please check the snap attached from Revit.

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

jeremy_tammik
Alumni
Alumni

Look at the explanation of API access to routing preferences in the developer guide:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

ncircle_a4
Explorer
Explorer

@jeremy_tammik Thank you for your prompt response.
When I tried the same solution as you proposed, the segment for index 1 (elbow) was null when type casted. Please see the code snippet below.
However, this solution is working perfectly fine for index 0.

for (int index = 0; index < 11; index++)
                {
                    var groupType = (RoutingPreferenceRuleGroupType)index;
                    var noOfRules = startPipeType.RoutingPreferenceManager
                        .GetNumberOfRules(groupType);

 

                    for (int i = 0; i < noOfRules; i++)
                    {
                        var rule = startPipeType.
                            RoutingPreferenceManager.
                            GetRule(groupType, i);
                        Segment segment = doc.GetElement(rule.MEPPartId) as Segment;
                        if (segment != null)
                        {

 

                        }
                    }
                }

0 Likes