PipeCreate(Document, ElementId, ElementId, ElementId, XYZ, XYZ) Method |
Creates a new pipe from two points.
Namespace: Autodesk.Revit.DB.PlumbingAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static Pipe Create(
Document document,
ElementId systemTypeId,
ElementId pipeTypeId,
ElementId levelId,
XYZ startPoint,
XYZ endPoint
)
Public Shared Function Create (
document As Document,
systemTypeId As ElementId,
pipeTypeId As ElementId,
levelId As ElementId,
startPoint As XYZ,
endPoint As XYZ
) As Pipe
public:
static Pipe^ Create(
Document^ document,
ElementId^ systemTypeId,
ElementId^ pipeTypeId,
ElementId^ levelId,
XYZ^ startPoint,
XYZ^ endPoint
)
static member Create :
document : Document *
systemTypeId : ElementId *
pipeTypeId : ElementId *
levelId : ElementId *
startPoint : XYZ *
endPoint : XYZ -> Pipe Parameters
- document Document
-
The document.
- systemTypeId ElementId
-
The ElementId of the piping system type.
- pipeTypeId ElementId
-
The ElementId of the pipe type.
- levelId ElementId
-
The level ElementId for the pipe.
- startPoint XYZ
-
The start point of the pipe.
- endPoint XYZ
-
The end point of the pipe.
Return Value
Pipe
The pipe.
Exceptions| Exception | Condition |
|---|
| ArgumentException |
The systemTypeId is not valid piping system type.
-or-
The pipe type pipeTypeId is not valid pipe type.
-or-
The ElementId levelId is not a Level.
-or-
The points of startPoint and endPoint are too close: for MEPCurve, the minimum length is 1/10 inch.
|
| ArgumentNullException |
A non-optional argument was null
|
Examplepublic static Pipe CreateNewPipe(Document document, ElementId systemTypeId, ElementId levelId)
{
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.OfClass(typeof(PipeType));
PipeType pipeType = collector.FirstElement() as PipeType;
Pipe pipe = null;
if (null != pipeType)
{
XYZ p1 = new XYZ(0, 0, 0);
XYZ p2 = new XYZ(10, 0, 0);
pipe = Pipe.Create(document, systemTypeId, pipeType.Id, levelId, p1, p2);
}
return pipe;
}Public Shared Function CreateNewPipe(document As Document, systemTypeId As ElementId, levelId As ElementId) As Pipe
Dim collector As New FilteredElementCollector(document)
collector.OfClass(GetType(PipeType))
Dim pipeType As PipeType = TryCast(collector.FirstElement(), PipeType)
Dim pipe__1 As Pipe = Nothing
If pipeType IsNot Nothing Then
Dim p1 As New XYZ(0, 0, 0)
Dim p2 As New XYZ(10, 0, 0)
pipe__1 = Pipe.Create(document, systemTypeId, pipeType.Id, levelId, p1, p2)
End If
Return pipe__1
End FunctionNo code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also