algorithmic modeling for Rhino
Hey,
How do I untrim a surface with rhinocommon? I am trying to do "closest point to surface" and then "curve on surface" but the former is not working because my surface is supposedly a brep (when doing rhino.geometry.surface.closestpoint()), even though ghcomp.surfaceclosestpoint is working with that surface (but I am trying to avoid ghcomp for performance reasons). I had been using ghcomp.untrim(), but what is the equivalent with rhinocommon? And while we are on the topic, how do I do "curve on surface" in rhinocommon. I am using python by the way.
Thanks
Tags:
The closest thing I've got so far is:
myuntrimmedsrf=Rhino.Geometry.Surface.ToNurbsSurface(mysrf)
And "curve on surface" is:
Rhino.Geometry.Surface.InterpolatedCurveOnSurface(mysrf,mypoints,mytolerance)
Rhino.Geometry.BrepFace.UnderlyingSurface returns the untrimmed base surface
Thanks.
While we are on the subject of brepfaces, I have been having problem with mybrep.Faces. It seems to return the faces untrimmed. I had a trimmed surface (which I input to python as a brep), but when I do mybrepface=mybrep.Faces[0], mybrepface is untrimmed.
Similarly, I did mysplitface=Rhino.Geometry.BrepFace.Split(mybrepface,mycrvs,.001), but when I try to single out the split faces via mysplitface.Faces it returns as the original mybrepface instead of small trimmed surfaces.
Why is that? And how do I explode a brep to get its trimmed faces or even its edges with rhinocommons?
Post your code AND the test data (internalized or provide Rhino file) and we'll see what's happening.
best, Peter
Hi Lawrence,
For untrimming part you can use the brepFace.DuplicateSurface() method.
For exploding brep brepFace.DuplicateFace() method. For extracting its edge curves BrepEdge.DuplicateCurve().
Check the attached file.
Thanks for the help.
If I am understanding this correctly, duplicatesurface() gives me untrimmed surface while duplicateface() gives me the face as it should be. What is the reasoning behind the need to duplicate as a surface or face? Why does it not work to do myfaces=mybrep.Faces?
These two "duplications" have a bit different reasons, why they should be applied.
Each brep face is based on some surface. This brep face has some trimming information. Surface does not. So by "extracting"(brepFace.DuplicateSurface()) the surface on which your brep face is based, you are getting an untrimmed surface.
Brep face is a topological entity of a brep. To explode a brep to its constituent parts, you can not just "extract" your brep faces from it. You have to convert it (the brep face) to a brep (a brep consisted of a single brep face - the one you "extracted"). That is exactly what brepFace.DuplicateFace() method does.
Thanks, I understand the difference now.
Is there anyway to populate those brepfaces with random points? I'd like to do something like the component "Populate Geometry" without doing ghcomp.PopulateGeometry.
You can use PointAt(randomU, randomV) method to evaluate a point on each brep face. Check the attached file.
Thanks man, I see that it is a sort of a trial and error to get a random point onto a brep.
I was attempting another method, one that would put the point a little more centered onto the brep. Essentially I will test to see if the point is in a set of curves, but if the point is too close to the edge, sometimes the result is incorrect. So I am trying to convert the brep into a mesh and then getting the center of the largest triangle face (which would have the largest inscribed circle and farthest center from its edges).
My question is: how do I generate a inscribed circle from 3 points, and then get its center?
If that is too difficult, how do I get the center point of a mesh face? Currently, I am getting the vertices of the mesh as a hole and then picking them via index (mesh face corners A B and C). With those I draw a polyline and then do polyline.CenterPoint. There has to be a quicker way.
Finally, is there a Rhinocommon command for "Point in Curves"?
Use the mesh.Faces.GetFaceCenter method for getting mesh faces centroids.
For the inscribed circle functionality there's no RhinoCommon method, which directly does that. You would either have to come up something with trigonometry/vector math (ask David how did he do it for the "InCircle" component), or you can use the ghpythonlib.components.InCircle node-in-code function.
For "Point in curve" functionality, use the Curve.Contains method.
It might be better to open a new topic, as all of this is not really related with your initial issue.
Happy new year!
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by