I’m writing a C# script to do Ice-ray latices, a classical example of a shape grammar. I have done the surface (brep) subdivision part and I’m now trying to offset the brep edges inward. After offsetting them I need to trim the Brep with the new boundary.
Brep.Curves3D is giving me the curves of the untrimmed surface. How do I get the Trimmed Surface edges?
Thanks, I’ll share it when it’s done.
I don’t know what I am missing! I can only get the edges of the untrimmed face.
Here is what I’ve tried:
1 - Returns the edges as curves of the untrimmed face of the brep (at origin)
2 - Returns the edges as curves of the untrimmed face of the brep (in place)
3 - Returns the edges as a polyline of the untrimmed face of the brep (in place)
4 - Returns the edges as a polyline of the untrimmed face of the brep (in place)
Thanks for you help, I managed to do what I wanted. It now looks like this:
private void RunScript(Brep aSup, double offSet, ref object A)
{
Brep brp = aSup;
CurveList listaCrv = new CurveList();
listaCrv.AddRange(brp.Loops.Select(l => l.To3dCurve()));
List<Curve> offsetCrv = new List<Curve>();
foreach(Curve crv in listaCrv){
Rhino.Geometry.AreaMassProperties centro = Rhino.Geometry.AreaMassProperties.Compute(crv);
Point3d ptCentro = centro.Centroid;
double param;
crv.ClosestPoint(ptCentro, out param);
Point3d ponto = crv.PointAt(param);
Vector3d normal = new Vector3d(ponto.X - ptCentro.X, ponto.Y - ptCentro.Y,
ponto.Z - ptCentro.Z);
Curve[] crv1 = crv.Offset(ptCentro, normal, offSet, 0.001, CurveOffsetCornerStyle.Sharp);
offsetCrv.AddRange(crv1);
}
A = offsetCrv;
}
It works, but my experience with IceRay lattices in grasshopper tells me that there can be a lot of problems caused by small edges when offsetting the outlines. Is there any method to ignore edges smaller than a certain length?
These curves are going to be used for digital fabrication with a CNC router. So, another thing I must do is to fillet the corners. Offset has an option to have rounded corners, but is there a way to control the radius?
@menno I’ve completed the script but I’m getting invalid curves with some breps and I can’t figure out why. The trimmed surfaces look ok when on rhino, but I get an invalid curve after I run Brep.Loops.Select(l => l.To3dCurve()). I’ve commented out the curve extraction of the script and tried to extract the boundary curves with rhino and I had no problem.
Any ideas?