Revit二次开发——创建Pipe

首先要创建一个Pipe,就需要看Pipe有哪些创建的方法

Revit二次开发——创建Pipe

由于我是需要在已知的两个XYZ创建管,所以选择了第三个方法   Create(Document document, ElementId systemTypeId, ElementId pipeTypeId, ElementId levelId, XYZ startPoint, XYZ endPoint);

参数说明:

接下来分别对几个参数进行创建

Document document:commandData.Application.ActiveUIDocument.Document。

ElementId systemTypeId:Revit二次开发——创建Pipe

ElementId pipeTypeId:ElementId Pipe_id = document_0.GetDefaultElementTypeId(ElementTypeGroup.PipeType);

ElementId levelId:(遍历找到当前项目中的所有标高,然后再foreach里面判断得到某一标高的id)

Revit二次开发——创建Pipe

创建管道:

Revit二次开发——创建Pipe