[FIXED] Ticket #6407 - python API access to 2d fillet OCC functionality

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #6407 - python API access to 2d fillet OCC functionality

Post by Kunda1 »

Updated thread title with issue #6407 and renamed thread for better comprehension
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Ticket #6407 - python API access to 2d fillet OCC functionality

Post by wmayer »

git commit b07be87677

Example:

Code: Select all

from FreeCAD import Base


# Defining the points
p1 = Base.Vector(0, 0, 0)
p2 = Base.Vector(5, 5, 0)
p3 = Base.Vector(-5, 5, 0)

ed1 = Part.makeLine(p3, p2)
ed2 = Part.makeLine(p2, p1)
pln = Part.Plane()

api = Part.ChFi2d.FilletAPI()
api.init(ed1, ed2, pln)

radius = 1
api.perform(radius)
fillet2d, ed1, ed2 = api.result(p2)
wire = Part.Wire([ed1, fillet2d, ed2])
Part.show(wire)
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Ticket #6407 - python API access to 2d fillet OCC functionality

Post by TheMarkster »

wmayer wrote: Sat May 28, 2022 9:22 am git commit b07be87677

Example:

Code: Select all

from FreeCAD import Base


# Defining the points
p1 = Base.Vector(0, 0, 0)
p2 = Base.Vector(5, 5, 0)
p3 = Base.Vector(-5, 5, 0)

ed1 = Part.makeLine(p3, p2)
ed2 = Part.makeLine(p2, p1)
pln = Part.Plane()

api = Part.ChFi2d.FilletAPI()
api.init(ed1, ed2, pln)

radius = 1
api.perform(radius)
fillet2d, ed1, ed2 = api.result(p2)
wire = Part.Wire([ed1, fillet2d, ed2])
Part.show(wire)
Would it be better to use pln = Part.Plane(p1, p2, p3) instead for a more general solution where all points are not already on the xy plane or does it not matter?
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [FIXED] Ticket #6407 - python API access to 2d fillet OCC functionality

Post by wmayer »

TheMarkster wrote: Mon May 30, 2022 4:12 pm Would it be better to use pln = Part.Plane(p1, p2, p3) instead for a more general solution where all points are not already on the xy plane or does it not matter?
It doesn't matter in this case. A plane where p1,p2,p3 lie on that all have z=0 is the xy plane and that's created with Part.Plane(). But for the general case you are right.
Post Reply