- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If i draw curves (with mouse/hand) for floor with hole in revit, the program can make the floor from them. The NewFloor api function can't make the same ... why?
Sample code:
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
var document = commandData.Application.ActiveUIDocument.Document;
Transaction transaction = new Transaction(document, "Create Floor");
transaction.Start();
var points1 = new List<XYZ>() //for outer contour
{
new XYZ(8.0, 0.0, 0.0),
new XYZ(0.0, 8.0, 0.0),
new XYZ(0.0, 0.0, 0.0)
};
var curves = new CurveArray();
curves.Insert(document.Application.Create.NewLine(points1[0], points1[1], true), 0);
curves.Insert(document.Application.Create.NewLine(points1[1], points1[2], true), 1);
curves.Insert(document.Application.Create.NewLine(points1[2], points1[0], true), 2);
var points2 = new List<XYZ>() //for hole
{
new XYZ(4.0, 1.5, 0.0),
new XYZ(1.5, 4.0, 0.0),
new XYZ(1.5, 1.5, 0.0)
};
curves.Insert(document.Application.Create.NewLine(points2[0], points2[1], true), 3);
curves.Insert(document.Application.Create.NewLine(points2[1], points2[2], true), 4);
curves.Insert(document.Application.Create.NewLine(points2[2], points2[0], true), 5);
var floorTypes = new FilteredElementCollector(document).OfClass(typeof(FloorType));
var floorType = floorTypes.ToList()[0] as FloorType;
var levels = new FilteredElementCollector(document).OfClass(typeof(Level));
var level = levels.ToList()[0] as Level;
var floor = document.Create.NewFloor(curves, floorType, level, true);
transaction.Commit();
}
catch
{
return Result.Failed;
}
return Result.Succeeded;
}
Error message:
"Can't make Extrusion."
How can i create floor with holes?
(I use Revit 2013 API)
Regards
David Schmidt
Solved! Go to Solution.