Python Fillet An Edge?

Fillet an Edge

I want a simple python FilletEdge function like this:

box = rs.AddBox(…) ## pretend 10x10x10

point_on_edge = [10, 10, 0] ## top right vertical edge.

FilletEdge(box, point_on_edge, 2)

Closest so far

I came kind of close with this function:

def FilletEdge2(self, object, edge_point=[0,0,0], fillet_radius=2.0):
“”“Fillets an edge on an object”“”

target_point = rg.Point3d(edge_point[0], edge_point[1], edge_point[2])

brep = rs.coercebrep(object)
min_distance = float(‘inf’)
closest_edge = None

for edge in brep.Edges:
success, parameter = edge.ClosestPoint(target_point)
if success:
found_pt = edge.PointAt(parameter)
distance = target_point.DistanceTo(found_pt)
if distance < min_distance:
min_distance = distance
closest_edge = edge

if closest_edge is not None:
edges_ienum = System.Arrayint
fillets_ienum = System.Arrayfloat
filleted_brep = rg.Brep.CreateFilletEdges(brep, edges_ienum, fillets_ienum, fillets_ienum, Rhino.Geometry.BlendType.Fillet, 0, 0.1)
if filleted_brep:
return True
return False

Problem with solution

This, however, always fillets the same edge ( the horizontal edge on the bottom left ). And it never removes the filleted corner – so I get the box with additional fillet surfaces inside the box, in the lower left corner, front to back.


Any idea how to actually create a simple fillet edge function that lets me take an object id, a point on the edge, and a radius to fillet that edge?

Or even better – an object, a list of points, and a list of fillets?

Dear @Imran
Edges to be fillet are identified by their index.
An integer.
If you caught an edge in the foreach loop just use
To identify it.
More easy use a for … in range loop so the index is directly known.
You might want to collect all edges to be fillet in a list (containing all indices.
Carefully check the rhinocommon documentation for the filletedge command.
…just replying from my mobile phone, no code therefore - sorry… hope this helps. Kind regards