【发布时间】:2021-06-01 05:13:27
【问题描述】:
我刚刚开发了一种可以创建地板的方法。 作为 Revit API 的新手,在我看来,我刚刚创建的地板存在,但在 Revit 上尚不可见。 所以我的问题如下:如何让这个地板在 Revit 中可见?
我可能错了,在这种情况下,如果你能向我解释问题,我会很高兴。
谢谢!
public Result CreateFloor(UIApplication uiapp)
{
UIDocument uiDoc = uiapp.ActiveUIDocument;
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
Document doc = uiDoc.Document;
using (Transaction transaction = new Transaction(doc))
{
if (transaction.Start("Create floor") == TransactionStatus.Started)
{
XYZ[] points = new XYZ[3];
points[0] = new XYZ(0,0,0);
points[1] = new XYZ(0,10,0);
points[2] = new XYZ(10,0,0);
CurveArray curve = new CurveArray();
Line line1 = Line.CreateBound(points[0], points[1]);
Line line2 = Line.CreateBound(points[1],points[2]);
Line line3 = Line.CreateBound(points[2], points[0]);
curve.Append(line1);
curve.Append(line2);
curve.Append(line3);
Floor floor=doc.Create.NewFloor(curve, false);
return Result.Succeeded;
}
else
{
transaction.RollBack();
return Result.Failed;
}
}
}
【问题讨论】:
标签: c# c#-4.0 c#-3.0 c#-2.0 revit-api