_Patch. 1 closed curve. Python


I need to make a patch from one closed curve.

import rhinoscriptsyntax as rs
rs.Command(‘_SelCrv’)
rs.Command(‘_Patch _Enter’)
#rs.AddPatch

Help me please

Hi @Alex_GM,

Use Brep.CreatePatch.

– Dale

Thanks. Can you write more? I need to do this in order to work through python.

Hi @Alex_GM,

How about this?

import Rhino
import scriptcontext as sc

def test_patch():
    filter = Rhino.DocObjects.ObjectType.Curve
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select curve", False, filter)
    if not objref or rc != Rhino.Commands.Result.Success: return
    
    crv = objref.Curve()
    if not crv: return
    
    brep = Rhino.Geometry.Brep.CreatePatch([crv], 60, 60, sc.doc.ModelAbsoluteTolerance)
    if brep:
        sc.doc.Objects.AddBrep(brep)
        sc.doc.Views.Redraw()
        
if __name__ == "__main__":
    test_patch()        

– Dale

1 Like

Thank you very much.This is magic. You helped me a lot.