Autodesk.Revit.UI.TemporaryGraphicsCommandData
是该软件的一个类,用于在Revit中创建暂时的图形(如临时线、多线段等)。
public class TemporaryGraphicsCommandData
Autodesk.Revit.UI.TemporaryGraphicsCommandData
类拥有以下成员:
Autodesk.Revit.DB.TessellatedShapeBuilderTarget
类型的参数。以下是 Autodesk.Revit.UI.TemporaryGraphicsCommandData
类的示例用法。
public class TemporaryGraphicsCommandDataExample : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
// 获取文档、视图和应用程序对象
Document doc = commandData.Application.ActiveUIDocument.Document;
View view = commandData.Application.ActiveUIDocument.ActiveView;
Autodesk.Revit.UI.UIApplication app = commandData.Application;
// 创建 TesselatedShapeBuilderTarget 类型的对象
var builder = new Autodesk.Revit.DB.TessellatedShapeBuilderTarget(view);
// 创建一个 TemporaryGraphicsCommandData 类型的对象
Autodesk.Revit.UI.TemporaryGraphicsCommandData data = new Autodesk.Revit.UI.TemporaryGraphicsCommandData(doc, app, view, builder);
//创建多段线
var vertices = new List<XYZ>(){new XYZ(0,0,0), new XYZ(5,5,5),new XYZ(10,10,10)};
builder.AddPolyline(vertices);
// 将临时图形添加到命令数据中
data.AppendSegment(builder);
return Result.Succeeded;
}
}