Hello,
I am trying to fin multiple curves on a surface with python script.
I have set up the code block for getting the curves and checking the direction of fin, etc. But, I am missing the function in this page: ExtrudeCurveNormal
I don’t find it in RhinoScriptSyntax. Has anyone rewrote this function in Python using Rhino Commons?
Thanks,
MHK.
Hi @MHK,
you might try Curve.OffsetNormalToSurface, below is a simplified example:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def DoSomething():
crv_ids = rs.GetObjects("Select curves on surface", 4, True, True, False)
if not crv_ids: return
rc = rs.GetSurfaceObject("Select base surface", False, False)
if not rc: return
curves = [rs.coercecurve(crv_id, -1, True) for crv_id in crv_ids]
surface = rs.coercesurface(rc[0], True)
height = 1.0
for crv in curves:
new_crv = Rhino.Geometry.Curve.OffsetNormalToSurface(crv, surface, height)
if new_crv and new_crv.IsValid:
scriptcontext.doc.Objects.AddCurve(new_crv)
scriptcontext.doc.Views.Redraw()
DoSomething()
Note that for the correct offset direction, you’ll need to take this into account.
_
c.
Hi @Clement,
Thank you for your reply. I will be on a short holiday from tomorrow, so, I don’t have time to try your function for now.
However, I wonder if your function will only give me a curve? I would like to have a surface just like how fin command in Rhino works. Can you please elaborate a little more how to get a surface from these two curves, one on surface and one offseted?
Thanks in advance and I will try working with your suggestion after the holiday.
MHK.
Hi @MHK, try this which makes a Sweep2 from the pairs of curves: FinCurves.py (1.2 KB)
_
c.