Select a set of brep edges

Hi all,
I need to select a set of edges of a brep in order to run a fillet by a Python script.
I wrote the following in order to select the edges, but nothing is selected:

import Rhino
import scriptcontext

def edgeB():
    filter = Rhino.DocObjects.ObjectType.PolysrfFilter
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select first set of polysurfaces", False, filter)
    if rc != Rhino.Commands.Result.Success: return rc
    if not objref: return Rhino.Commands.Result.Failure
    brep = objref.Brep()
    bre = objref.Object()
    edgelist=brep.Edges
    for i in edgelist:
        if i.Degree>1:
            print bre.SelectSubObject(i.ComponentIndex(),True,True)
scriptcontext.doc.Views.Redraw()
edgeB()

There something wrong in my script?
Thanks,
g

Hi gianpaolo,

i`m not shure but i think you cannot select or highlight edges this way and then start the regular fillet command. You also have a print statement before your selection in the above example.

In order to fillet brep edges, the only way i know is to use a rolling ball fillet with (extracted) surfaces and pass pick-points as uv parameters.

c.

gianpaolo, i forgot to attach the modified example:


import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def edgeB():
    filter = Rhino.DocObjects.ObjectType.PolysrfFilter
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select first set of polysurfaces", False, filter)
    if rc != Rhino.Commands.Result.Success: return rc

    if not objref: return Rhino.Commands.Result.Failure

    brep = objref.Brep()
    bre = objref.Object()
    bre.Select(False)

    edgelist=brep.Edges
    for i in edgelist:
        if i.Degree>1:
            print(i)
            bre.SelectSubObject(i.ComponentIndex(),True, True)
            scriptcontext.doc.Views.Redraw()
            
    rs.Sleep(500)

edgeB()

c.

1 Like

Grazie mille!!!
Thanks Clement,
it seems that it not possible select persistently a brepedge as in the case of mesh edge.
Thanks for the suggestion about fillet, best wishes,
g

Assuming persistent selection is desired (subobject remains selected when a command/script ends), this will only be possible in Rhino 6.

Also regarding filleting, you might take a look at Rhino.Geometry.Surface.CreateRollingBallFillet. This might be all you need…

import rhinoscriptsyntax as rs
import Rhino as rh
import scriptcontext as sc

id0 = rs.GetObject("First surface")
pt0 = rs.GetPointOnSurface(id0, "Point on first surface")
uv0 = rs.SurfaceClosestPoint(id0, pt0)

id1 = rs.GetObject("Second surface")
pt1 = rs.GetPointOnSurface(id1, "Point on second surface")
uv1 = rs.SurfaceClosestPoint(id1, pt1)

srf0 = rs.coercesurface(id0, True)
srf1 = rs.coercesurface(id1, True)
tol = rs.UnitAbsoluteTolerance()

results = rh.Geometry.Surface.CreateRollingBallFillet(srf0, uv0, srf1, uv1, 1.0, tol)
for rc in results:
    sc.doc.Objects.AddSurface(rc)
    sc.doc.Views.Redraw()
1 Like

Thanks Dale,
I have try in Rhino 6, but the selection is not yet persistent (or I must change anything in the script).
I know the Surface.CreateRollingBallFillet, but my model is a complex closed polysurface. I need to fillet a set of edge with a specific lenght and a specific degree. More over I need to change the radius of the filllet.
I’d like to persistently select this edges and then apply rs.command("_FilletEdge…
Thanks again,
g

The SelectSubObject function in RhinoCommon V6 will eventually have a new, additional bPersistentSelect flag that you will need to specify. Implement it is on the V6 to-do list.

Also, the FilletEdge command does not recognize pre-selected edges. This is also on the V6 list.

http://mcneel.myjetbrains.com/youtrack/issue/RH-28849

Thanks

hi i need the gh file this python code please help me

filletsurface.gh (7.6 KB)