Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change Pipe Outer Diameter

2 REPLIES 2
Reply
Message 1 of 3
sam.z
1954 Views, 2 Replies

Change Pipe Outer Diameter

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?

 

    // 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;
    }

 

2 REPLIES 2
Message 2 of 3
ollikat
in reply to: sam.z

Hi

I'm not an expert on this subject, so I can't tell anything precise here. But take a look of class "Segment". It might be something that you'll find useful(?). I think it's part of a concept called "routing preferences" in Revit. So as you have observer, you can't change this kind of properties directly to instance / type.

The SDK sample "RoutingPreferenceTools" contains some example usage of this class (see RoutingPreferenceBuilder).

Message 3 of 3
timmmeister
in reply to: sam.z

Sam,

 

You can remove/add MEPSizes to a segment that you then assign to the pipe.

 

newSeg = PipeSegment.Create(doc, newMat.Id, newPipeSchedule.Id, sizeSet);
newSeg.RemoveSize(rDiam);
newSeg.AddSize(new MEPSize(rDiam / 12.0, rInnerDiam / 12.0, rOuterDiam / 12.0, true, true));

pipe.get_Parameter(BuiltInParameter.RBS_PIPE_SEGMENT_PARAM).Set(newSeg.Id);

 

David 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community