Hello everybody.
The question is simple, but no one seems to know the answer.
I've tried several ways, the simplest and most linear is to use the relative parameter.
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).Set(0.050 * 3.28084); // 50mm
However, in this way the internal and external diameter do not correspond to the correct MEPSize of the related PipeSegment.
How can I set the diameter of a pipe as in Revit UI?
Solved! Go to Solution.
Solved by nicolaadn. Go to Solution.
Solved by RPTHOMAS108. Go to Solution.
Probably the size has to exist in the segment used to be selected.
When you change that outside diameter parameter it should pick the nearest size match in the list of sizes for that segment. Perhaps with the API it just adds the size to the segment with no thickness set (check what is defined in the segment sizes).
You can change sizes for segment via.
Pipe.PipeSegment
PipeSegment.AddSize
PipeSegment.RemoveSize
PipeSegment,GetSizes
So perhaps add the size to segment first (OD and ID) then change the outside diameter on the Pipe instance as you originally did above.
Thanks for reply. I made some attempts
I found the definitive solution: I have to use a better approximation from millimeters to feet, or directly the NominalDiameter field of MEPSize.
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).Set(0.050 * 3.280839896); // 50 mm
or
PipeSegment pipeSegment = ...;
MEPSize size = ...;
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_SEGMENT_PARAM).Set(pipeSegment.Id);
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).Set(size.NominalDiameter);
Can't find what you're looking for? Ask the community or share your knowledge.