Many times we need to create sloped floors with not only regular shapes such as rectanglar but also irregular ones such as round. In this post, let’s try to tilt a round floor using Revit .NET API and C#.
Arc arc1 = CachedDoc.Application.Create.NewArc(new Plane(XYZ.BasisZ, XYZ.Zero), 10.0, 0.0, Math.PI);
Arc arc2 = CachedDoc.Application.Create.NewArc(new Plane(XYZ.BasisZ, XYZ.Zero), 10.0, Math.PI, Math.PI * 2);
CurveArray profile = new CurveArray();
profile.Append(arc1);
profile.Append(arc2);
Floor floor = CachedDoc.Create.NewFloor(profile, false);
CachedDoc.Regenerate();
Line axis = CachedDoc.Application.Create.NewLine(XYZ.Zero, XYZ.BasisY, false);
ElementTransformUtils.RotateElement(CachedDoc, floor.Id, axis, Math.PI / 6);
As can bee seen, the round floor is created onto the XY plane and is being tried to be tilted around the Y axis, but the following error message comes up.
Can't change plane of Floor Sketch.
Obviously, Revit .NET API does not allow us to change the plane of the floor sketch programmatically thus does not allow us to title it. Otherwise, how could we title a floor without touching on its sketch plane then?
Revit Addin Wizard (RevitAddinWizard) provides various wizards, coders and widgets to help program Revit addins. It can be downloaded from the Download link at the bottom of the blog index page.