Revit二次开发之创建详图线并赋予颜色
(2016-10-12 21:54:47)
标签:
365it |
分类: Revit二次开发 |
public Result
Execute(ExternalCommandData commandData, ref string message,
ElementSet elements)
{
UIApplication app =
commandData.Application;
Document doc =
app.ActiveUIDocument.Document;
View view = doc.ActiveView;
Transaction ts = new
Transaction(doc,"BIM");
ts.Start();
XYZ startPoint = new XYZ(0, 0,
0);
XYZ endPoint = new XYZ(10, 10,
0);
Line geomLine
=Line.CreateBound(startPoint, endPoint);
DetailLine line =
doc.Create.NewDetailCurve(view, geomLine) as DetailLine;
GraphicsStyle gs = line.LineStyle as
GraphicsStyle;
gs.GraphicsStyleCategory.LineColor=
new Color(255, 0, 0);
ts.Commit();
return Result.Succeeded;
}