Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public static Autodesk.DesignScript.Geometry.Solid CreateCutPlaneSolid(global::Revit.Elements.Element planv)
View planView = planv.InternalElement as View;
BoundingBoxXYZ bbActiview = planView.get_BoundingBox(null);
Plane planePlanView = planView.SketchPlane.GetPlane();
PlanViewRange viewRange = (planView as ViewPlan).GetViewRange();
double cutPlaneHeight = viewRange.GetOffset(PlanViewPlane.CutPlane);
XYZ pt0 = new XYZ(bbActiview.Min.X, bbActiview.Min.Y, bbActiview.Min.Z);
XYZ pt1 = new XYZ(bbActiview.Max.X, bbActiview.Min.Y, bbActiview.Min.Z);
XYZ pt2 = new XYZ(bbActiview.Max.X, bbActiview.Max.Y, bbActiview.Min.Z);
XYZ pt3 = new XYZ(bbActiview.Min.X, bbActiview.Max.Y, bbActiview.Min.Z);
XYZ pt00 = ProjectOnto(planePlanView, pt0);
XYZ pt11 = ProjectOnto(planePlanView, pt1);
XYZ pt22 = ProjectOnto(planePlanView, pt2);
XYZ pt33 = ProjectOnto(planePlanView, pt3);
Line edge00 = Line.CreateBound(pt00, pt11);
Line edge11 = Line.CreateBound(pt11, pt22);
Line edge22 = Line.CreateBound(pt22, pt33);
Line edge33 = Line.CreateBound(pt33, pt00);
List<Curve> edges0 = new List<Curve>();
CurveLoop baseLoop0 = CurveLoop.Create(edges0);
List<CurveLoop> loopList0 = new List<CurveLoop>();
Solid preTransformSolid =
XYZ.BasisZ, cutPlaneHeight);
Solid transformSolid = SolidUtils.CreateTransformed(preTransformSolid,
return transformSolid.ToProtoType();
public static XYZ ProjectOnto(this Plane plane, XYZ p)
double d = plane.SignedDistanceTo(p);
XYZ q = p - d * plane.Normal;
return q;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.