Autodesk.Revit.DB.Electrical.Wire
是一个表示 Revit 电气系统中导线的类。在 Revit API 中,导线是一种专门用于绘制电气图的基本元素,与电缆和电线不同。
Wire(ElementId typeId, Line line, ElementId startConnection, ElementId endConnection)
根据给定的类型、线路、起始连接和结束连接创建一个导线对象。
typeId
:一个表示导线类型的 Revit 元素 ID。line
:一个 Autodesk.Revit.DB.Line
类型的对象,表示导线的位置和方向。startConnection
:导线的起始连接。endConnection
:导线的结束连接。TypeId
:获取或设置导线的类型 ID。Line
:获取或设置导线的位置和方向。StartConnection
:获取或设置导线的起始连接。EndConnection
:获取或设置导线的结束连接。Duplicate(ElementId newTypeId, ElementId newStartConnection, ElementId newEndConnection):Autodesk.Revit.DB.Element
复制此导线并返回新的对象。
参数:
newTypeId
:一个表示新元素类型的 Revit 元素 ID。newStartConnection
:新导线的起始连接。newEndConnection
:新导线的结束连接。返回值:一个新的 Wire
对象。
// 创建一个新的导线
var typeId = new ElementId(BuiltInElectricalFixtureType.GFCIReceptacle);
var line = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(10, 0, 0));
var wire = new Wire(typeId, line, new ElementId(123), new ElementId(456));
// 复制并修改导线
var newTypeId = new ElementId(BuiltInElectricalFixtureType.SwitchSinglePole);
var newStartConnection = new ElementId(789);
var newEndConnection = new ElementId(101112);
var newWire = wire.Duplicate(newTypeId, newStartConnection, newEndConnection);