List outSideCurve = new List(); List inSideCurve = new List(); foreach (var obj in…
- User
List outSideCurve = new List(); List inSideCurve = new List();
foreach (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 outSideClosedCurve = new List(); List OutBreps = new List(); foreach (var crv in inerCurveOutside) { List tempCurve = new List(); 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()); }
DA.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
- User
you should do it one by one and the next BooleanDifference should be with the result of last BooleanDifference and the next item of otherBreps.
- Assistant
- 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]);
} 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; }
I have this method but its not right and needs to be refactored. the logic of inputCurve.Count == 2 need more work. because the direction of 2 curves is not certainly unified its not right to just connect their end line together
- Assistant