0

我想在从 revit 绘制管道时以编程方式将用于创建管道的指针从一个地方移动到另一个地方。

请参考下图。

在此处输入图像描述

从 revit 绘制管道时,我可以更改偏移量(例如从 15 到 16)。但无法以编程方式将创建管道指针位置从红点更改为橙色点(参考图片)。

这可能吗?

或者

我们可以在从 Revit 绘制管道时以编程方式更改或访问偏移值吗?

参考下图

在此处输入图像描述

请建议..

问候

纳米特耆那教

4

1 回答 1

0

通过Autodesk.Revit.DB.Plumbing命名空间:有一个功能:

public static Pipe Create(Document document, ElementId systemTypeId, ElementId pipeTypeId, ElementId levelId, XYZ startPoint, XYZ endPoint);

您可以在代码中使用它,例如:

XYZ fStartPoint = new XYZ(0.0, 0.0, 0.0);  //Modify these values to your desired coordinates
XYZ fEndPoint = new XYZ(0.0, 0.0, 0.0);    //Modify these values to your desired coordinates

ElementId pPipeTypeId = pPreviousPipe.PipeType.Id;
ElementId pPipeLevelId = pPreviousPipe.LevelId;
ElementId pSystemId = pPreviousPipe.MEPSystem.Id;

if (pPipeLevelId == ElementId.InvalidElementId)
{
    Level lLevel = null;
    using (Transaction pTrans = new Transaction(doc, "Get Level"))
    {
        pTrans.Start();
        lLevel = Level.Create(doc, pPreviousPipe.LevelOffset;
        pTrans.Commit();
    }

    pPipeLevelId = lLevel.Id;
}

Pipe.Create(doc, pSystemId, pPipeTypeId, pPipeLevelId, fStartPoint, fEndPoint);

该函数有重载Create(...),所以也看看这些。如果您要连接Pipes 和FamilyInstances 之类的配件,您可以使用

public static Pipe Create(Document document, ElementId pipeTypeId, ElementId levelId, Connector startConnector, Connector endConnector);

Connector这将通过s直接连接它们。至于抵消管道,我上面所做的应该最适合你。祝你好运!

添加注释(编辑)

第二Offset张图片中的 是指Z飞机的轴。你想做一些更像

var fTemp = pPreviousPipe.Location as LocationCurve;
var fEnd = fTemp.Curve.GetEndPoint(1);    

//Index 0 is the beginning of the pipe (where user started drawing) 
//Index 1 is the end of the pipe (where user stopped drawing)

XYZ fStartPoint = new XYZ(fEnd.X, fEnd.Y - .5, fEnd.Z);
double dPipeLength = 10.0;
XYZ fEndPoint = new XYZ(fStartPoint.X + dPipeLength, fStartPoint.Y, fStartPoint.Z);
于 2017-02-02T17:52:06.563 回答