List<Curve> outSideCurve = new List<Curve>(); List<Curve> inSideCurve = new…
- User
List outSideCurve = new List(); List inSideCurve = new List();
codeforeach (var obj in AllObjects) { if (obj is HatchObject) { Hatch hatchObject = (Hatch)obj.Geometry; outSideCurve.AddRange(hatchObject.Get3dCurves(true)); inSideCurve.AddRange(hatchObject.Get3dCurves(false)); } } var BrepRegion = Brep.CreatePlanarBreps(rectangle[0], 0.001); var inerCurveOutside = Curve.ProjectToBrep(outSideCurve, BrepRegion, Vector3d.ZAxis, 0.001); var inerCurveInside = Curve.ProjectToBrep(inSideCurve, BrepRegion, Vector3d.ZAxis, 0.001); //var test = inerCurveOutside[0]; List<Curve> outSideClosedCurve = new List<Curve>(); List<Brep> OutBreps = new List<Brep>(); foreach (var crv in inerCurveOutside) { List<Curve> tempCurve = new List<Curve>(); Line ColsingLine = new Line(crv.PointAtStart, crv.PointAtEnd); tempCurve.Add(crv); tempCurve.Add(ColsingLine.ToNurbsCurve()); outSideClosedCurve.Add(Curve.JoinCurves(tempCurve)[0]); }List tempBrep = new List(); foreach (var crv in outSideClosedCurve) { tempBrep.AddRange( Brep.CreatePlanarBreps(crv, 0.001)); OutBreps.AddRange(Brep.CreateBooleanDifference()); }
codeDA.SetDataList(0, outSideClosedCurve); DA.SetDataList(1, inerCurveInside);}
this is my Grasshopper component code. I want to between all the members in the tempBrep creat a Boolean difference in a way that find the one brep that have biggest area and from that one Boolean different others
- Assistant
To achieve your goal of performing a Boolean difference using the Breps generated in , you'll need to modify your existing code slightly. Specifically, you'll want to find the Brep with the largest area and then perform a Boolean difference between that Brep and all the other Breps in the list.
- User
public static List TrimHatch(Hatch inputHatch, Curve region) { var doc = RhinoDoc.ActiveDoc; List Outputs = new List(); List outSideCurve = new List(); List inSideCurve = new List(); outSideCurve.AddRange(inputHatch.Get3dCurves(true)); inSideCurve.AddRange(inputHatch.Get3dCurves(false));
- Assistant
- User
public static Curve CloseCurve(List inputCurve) { List tempCurve = new List(); Curve ClosedCurve = null; if (inputCurve.Count == 1) { Line ColsingLine = new Line(inputCurve[0].PointAtStart, inputCurve[0].PointAtEnd); tempCurve.Add(inputCurve[0]); tempCurve.Add(ColsingLine.ToNurbsCurve()); ClosedCurve = (Curve.JoinCurves(tempCurve)[0]);
code} else if (inputCurve.Count == 2) { Line ColsingLine1 = new Line(inputCurve[0].PointAtStart, inputCurve[1].PointAtStart); Line ColsingLine2 = new Line(inputCurve[0].PointAtStart, inputCurve[1].PointAtEnd); Line ColsingLine3 = new Line(inputCurve[0].PointAtEnd, inputCurve[1].PointAtStart); Line ColsingLine4 = new Line(inputCurve[0].PointAtEnd, inputCurve[1].PointAtEnd); tempCurve.Add(inputCurve[0]); tempCurve.Add(inputCurve[1]); tempCurve.Add(ColsingLine1.ToNurbsCurve()); tempCurve.Add(ColsingLine2.ToNurbsCurve()); ClosedCurve = (Curve.JoinCurves(tempCurve)[0]); } return ClosedCurve; - Assistant