Hello
I am trying to set a Pipes inner and outer diameter. Currently if the Pipe has a diameter of 150mm, then the Pipe automatically has an inner diameter of 154mm and an outer diameter of 168mm. Our drainage guys are complaining that our addin is bringing in their pipes slightly too low (caused by the outer diameter of the Pipe).
How can we change a Standard Pipes outer diameter?
I've made the below attempts but none work. I've tried setting the Pipes inner and outer diameter parameters but these are read only params. I also tried setting the PipeType's inner and outer diameter parameters but these are read only params aswell. Note its not the Pipes insulation thickness thats the cause (because thats 0mm).
Any ideas how to change a Pipes outer and inner diameter?
Code:
// None work
public Pipe createPipeSetOuterDiameter(Document doc, PipeType pipeType, XYZ strt, XYZ end)
{
// Set Pipe Types outer and inner diameter: Fails
pipeType.get_Parameter(BuiltInParameter.RBS_PIPE_OUTER_DIAMETER).Set(0.49213);
pipeType.get_Parameter(BuiltInParameter.RBS_PIPE_INNER_DIAM_PARAM).Set(0.49213);
Pipe pipe = doc.Create.NewPipe(strt, end, pipeType);
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).Set(0.55);
return pipe;
}
public Pipe createPipeSetOuterDiameterTech2(Document doc, PipeType pipeType, XYZ strt, XYZ end)
{
Pipe pipe = doc.Create.NewPipe(strt, end, pipeType);
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).Set(0.55);
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_OUTER_DIAMETER).Set(0.49213); // Cannot set inner or outer diameter. Both are read only
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_INNER_DIAM_PARAM).Set(0.49213);
return pipe;
}
public Pipe createPipeSetOuterDiameterTech3(Document doc, PipeType pipeType, XYZ strt, XYZ end)
{
Pipe pipe = doc.Create.NewPipe(strt, end, pipeType);
pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM).Set(0.55);
ICollection<ElementId> insulationIds = InsulationLiningBase.GetInsulationIds(doc, pipe.Id);
TaskDialog.Show("Number ", insulationIds.Count.ToString()); // Always outputs "Number 0"
foreach (ElementId insulationId in insulationIds)
{
Element insEl = doc.GetElement(insulationId);
Autodesk.Revit.DB.Plumbing.PipeInsulation insulation = insEl as Autodesk.Revit.DB.Plumbing.PipeInsulation;
// Still unable to set the outer diameter just the insulation thickness
if (insulation != null) {
insulation.Thickness = 0.49213; //Set value to whatever you want here, value is always in feet, regardless of the units of your model
TaskDialog.Show("Thickness", insulation.Thickness.ToString());
}
}
return pipe;
}