OCCT icon indicating copy to clipboard operation
OCCT copied to clipboard

Fillet can not round a face

Open farahats9 opened this issue 1 year ago • 8 comments

Category

Modeling

Severity

Major

Description

I know this bug is in the original tracker 25478

When modeling existing parts, often fillets touch each other directly, meaning that there is no linear segment remaining, but they just have tangent (C1) point at which they touch.When trying to apply those fillets OCCT thrown a standard_error with "BRep_API: command not done"

but it has been 10 years since it was reported and there is no sign of any attention or progress done on this. Please someone needs to look into it since it feels like the most important problem now in FreeCAD

Expected Behavior

if the fillet radius is big enough that there are no linear faces remaining, it should round the face.

Actual Behavior

The fillet will work as long as the radius is small enough to keep some face remaining. if it is big it will not work.

Sample Code or DRAW Tcl Script

bugs modalg_7 bug25478_1, bug25478_2

pload MODELING
box Box 10 10 10
explode Box E
blend Fillet Box 5 Box_1 5 Box_3
#tolerance ang : 0.01
#tolerance 3d : 0.0001
#tolerance 2d : 1.0000000000000001e-05
#fleche : 0.001
#tolblend 0.01 0.0001 1.0000000000000001e-05 0.001
#
#the variable Fillet is left unset
#concave example
#generated by FreeCAD 0.15.4183 +7 (Git)
pload MODELING
box Box001 10 10 10
box Box002 10 10 12
ttranslate Box002 5 5 -1
bcut Cut Box001 Box002
explode Cut E
blend Fillet002 Cut 2.5 Cut_13 2.5 Cut_17 2.5 Cut_18
donly Fillet002

Operating System

Linux

Compiler

GCC

Bitness

64-bit

OCCT Version

latest

farahats9 avatar Nov 29 '24 15:11 farahats9

What do you mean by "round the face"?

  • Use the requested radius and leave sharp corners?

  • Change the radius to fit?

  • Just create some artibrary shape that looks "round"?

GeneGH avatar Nov 29 '24 17:11 GeneGH

It may be easier to explain visually:

I have the following simple shape with height 10 mm image

now I want to apply a fillet on all sides that is 4 mm, will work without any problem image

because there is still a face connecting the 2 red fillets there is no problem so far.

now if I want to make the fillet 5mm that means they will touch and the grey face between them will have 0 mm length and will refuse to do the fillet with the error: BRep_API: command not done

I hope this makes the issue a bit clearer, this is also in chamfer not just a fillet problem, let me know if you need any information or if I can be of any help.

farahats9 avatar Nov 29 '24 17:11 farahats9

I understand the issue. I have seen it many times.

The question is what should happen when the fillet cannot be completed as specified.

GeneGH avatar Nov 30 '24 15:11 GeneGH

I don't know if it will be easy but the logic of this should be: If the fillet causes a face dimension to be 0 then delete that face.

What should happen in my example is the gray face that was 2 mm and became 0 mm due to fillets should be deleted and the upper and bottom fillets should connect as tangents. Does that make sense? I don't know if there is an easier way to make this work but that's how it is in other commercial CAD software.

farahats9 avatar Nov 30 '24 15:11 farahats9

OK, now they are tangent at the former face along the edge. What happens at the other ends? Sharp break in the curve? Changed radius of the fillet so that the other ends can be tangent to those faces?

GeneGH avatar Nov 30 '24 15:11 GeneGH

In my example both the top and bottom fillets have the same radius so both of them would be tangent without changing any radius.

But if I understand you correctly you are asking what if they cannot be tangent due to radius difference or other constraints, from my experience in other CAD software, you should never change the other fillet's radius, keep the sharp corners and let the dimension changes in the user's control.

farahats9 avatar Nov 30 '24 15:11 farahats9

I don't know if this would help in the implementation, but I believe the behavior used by commercial CAD software is equivalent to performing the fillet on each edge loop separately and then taking the intersection. So in this example we would duplicate the part, perform the top fillet on one copy, perform the bottom fillet on the other copy, and then do a boolean intersection to get the final result. As long as boolean intersections don't have some other issue, this should work for both over-fillet and critical-fillet (as is used in this issue), so two birds with one stone.

dragazo avatar Dec 11 '24 17:12 dragazo

any updates on this?

drwho495 avatar Apr 14 '25 18:04 drwho495

This one bug is pretty bad, with the Naming issue the fillet can cause this one is probably one of the biggest issues there are currenty for using OCCT for a CAD program. Are there any plans on working on this?

MisterMakerNL avatar Aug 06 '25 09:08 MisterMakerNL

I've manually tested @dragazo's suggestion on a simpler version, filleting two edges until they overlap, seems quite promising

Image

Interestingly, the concave example provided doesn't quite work in some other commercial CAD applications, such as OnShape.

Image

However it does currently work in OCCT if you do the outer edges first then the middle one, so I think this should not be the focus for the issue for now.

And here is a "working" example for the "fillet" face reported in https://github.com/Open-Cascade-SAS/OCCT/issues/172#issuecomment-2508194883.

Image

I've built a test naive-API that will do one fillet at a time then run the intersection, it works for these use cases but it is way slower than the previous approach (all-in-one).

Maybe we can surface the OneCorner : fillets have too big radiuses exception that is thrown on an higher level in the API and then execute this naive approach.

angelobartolome avatar Aug 26 '25 20:08 angelobartolome

If anyone wants to test in FreeCAD, I'm sharing my test API here, I'll not open an PR for this because it is very simple and probably not adequate solution, since I'm pretty much duplicating the FilletAPI adding that feature. I think the best course would be to discuss how to surface this API, if we would extend the original BRepFilletAPI_MakeFillet, or something else.

https://github.com/angelobartolome/OCCT/commit/1b81bbbcc420ded437e347578e570b543853afb2

angelobartolome avatar Aug 27 '25 12:08 angelobartolome

I understand why you don't want to add the solution in a PR in its current form but if we leave it for discussion it will be years before it is implemented, I recommend adding the PR since it is already better than what we have.

Also since Chamfers have the same exact problem do you think you can apply a similar fix to it?

farahats9 avatar Aug 27 '25 13:08 farahats9

does this have the Modified and Generated methods? freecad has to have those for its toponaming algorithm

drwho495 avatar Aug 27 '25 14:08 drwho495

Really nice work also the solution sounds very simple! Thanks for looking into this!

MisterMakerNL avatar Aug 27 '25 15:08 MisterMakerNL

In any case, this concave situation wouldn’t be fixed, right? (1) is the geometry before applying the filet, (2) is when a fillet with radius higher than the step is applied.

Image

pierreporte avatar Aug 27 '25 15:08 pierreporte

does this have the Modified and Generated methods? freecad has to have those for its toponaming algorithm I think should yes 🤔, haven't tried yet since I'm doing my tests using the Draw Test Harness (Tcl scripts)

In any case, this concave situation wouldn’t be fixed, right? (1) is the geometry before applying the filet, (2) is when a fillet with radius higher than the step is applied.

Image

I tried applying this and you're right, it is not working. Need to check for this case. I think it is related to the core issue about over filleting

I understand why you don't want to add the solution in a PR in its current form but if we leave it for discussion it will be years before it is implemented, I recommend adding the PR since it is already better than what we have.

Also since Chamfers have the same exact problem do you think you can apply a similar fix to it?

For chamfers yes, it is quite simple to replicate the "Naive" class. I can do it later today.

Do anyone know if there is some documentation and/or visual explanation on how the Fillet algorithm works? I'd like to go deeper to why it can't handle over-filetting. Looks like the logic is somewhere in ChFi3d_Builder_C1.cxx but it is quite hard to follow...

angelobartolome avatar Aug 27 '25 16:08 angelobartolome

In an ideal world, would a fix for this problem make something like this possible?

https://github.com/user-attachments/assets/35f98378-3249-4402-9bed-6734abea4391

LinuxinaBit avatar Sep 03 '25 16:09 LinuxinaBit

@LinuxinaBit I just tested it out, and I believe the solution I proposed (doing each edge loop separately and taking the intersection) would also make what you showed in Onshape possible in FreeCAD.

In the short term if you need this feature, you can always just explicitly dupe the part, do both fillets, and manually do the intersection.

dragazo avatar Sep 24 '25 19:09 dragazo