前言
这个例子介绍如何创建幕墙,以及如何通过 API 编辑幕墙。
内容
运行效果:
创建幕墙
幕墙在 Revit 体系里面属于墙的一种,因此,它对应的 API 类型仍然为 Wall
,只是类型有差异。
// WallGeometry::CreateCurtainWall
baseline = Line.CreateBound(m_startXYZ, m_endXYZ);
Wall wall = Wall.Create(m_myDocument.Document, baseline, m_selectedWallType.Id, m_selectedView.GenLevel.Id, 20, 0, false, false);
获取幕墙网格
namespace Autodesk.Revit.DB
{
public class Wall : HostObject
{
public CurtainGrid CurtainGrid { get; }
// 省略其它
}
}
和幕墙网格编辑相关的接口都在 CurtainGrid
,包括网格线的增减、幕墙单元的操作等 :
namespace Autodesk.Revit.DB
{
public class CurtainGrid : APIObject
{
public CurtainGridAlignType Grid1Justification { get; set; }
public double Grid1Offset { get; set; }
public CurtainGridAlignType Grid2Justification { get; set; }
public double Grid2Angle { get; set; }
public double Grid2Offset { get; set; }
public int NumULines { get; }
public int NumVLines { get; }
public int NumPanels { get; }
public double Grid1Angle { get; set; }
public CurtainGridLine AddGridLine(bool isUGridLine, XYZ position, bool oneSegmentOnly);
public Element ChangePanelType(Element panel, ElementType newSymbol);
public CurtainCell GetCell(ElementId uGridLineId, ElementId vGridLineId);
public ICollection<CurtainCell> GetCurtainCells();
public ICollection<ElementId> GetMullionIds();
public Panel GetPanel(ElementId uGridLineId, ElementId vGridLineId);
public ICollection<ElementId> GetPanelIds();
public ICollection<ElementId> GetUGridLineIds();
public ICollection<ElementId> GetUnlockedMullionIds();
public ICollection<ElementId> GetUnlockedPanelIds();
public ICollection<ElementId> GetVGridLineIds();
}
}