# 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:

scriptcontext.doc.Objects.AddBrep(filleted_brep[0])

scriptcontext.doc.Views.Redraw()

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.

# help!

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?