Unexpected Chamfer behaviour when face selected
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Unexpected Chamfer behaviour when face selected
Hi all,
There is an unexpected behaviour when chamfering letter shapes with a inner hole (eg "R" "O") using the Distance and angle type.
When selecting a face the inner edges have the chamfer applied in the opposite direction to the outer edges.
A consistent direction can be achieved by selecting the edges directly and then manually flipping the direction of the inner edges.
(See GIF's below and the attached example)
To apply the chamfer consistently the code around FeatureChamfer.cpp: Line 148 would need to be changed so the chamfer distance is applied along the face that was not originally selected.
Before attempting to make this change does anyone see an issue with this approach?
Cheers,
Troy
Chamfer Face Selected
Chamfer Edges Selected
Note: 0.19.2 behaves the same
OS: Windows 10 Version 1909
Word size of FreeCAD: 64-bit
Version: 0.20.25644 (Git)
Build type: Release
Branch: master
Hash: 12d0974525afe812e81ad623f7d915cb1784118e
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/Australia (en_AU)
There is an unexpected behaviour when chamfering letter shapes with a inner hole (eg "R" "O") using the Distance and angle type.
When selecting a face the inner edges have the chamfer applied in the opposite direction to the outer edges.
A consistent direction can be achieved by selecting the edges directly and then manually flipping the direction of the inner edges.
(See GIF's below and the attached example)
To apply the chamfer consistently the code around FeatureChamfer.cpp: Line 148 would need to be changed so the chamfer distance is applied along the face that was not originally selected.
Before attempting to make this change does anyone see an issue with this approach?
Cheers,
Troy
Chamfer Face Selected
Chamfer Edges Selected
Note: 0.19.2 behaves the same
OS: Windows 10 Version 1909
Word size of FreeCAD: 64-bit
Version: 0.20.25644 (Git)
Build type: Release
Branch: master
Hash: 12d0974525afe812e81ad623f7d915cb1784118e
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/Australia (en_AU)
- Attachments
-
- letter_chamfer.FCStd
- (288.76 KiB) Downloaded 71 times
Last edited by troyp76 on Fri Sep 10, 2021 11:00 am, edited 1 time in total.
Re: Inconsistent Chamfer behaviour when face selected
This explains well from 3D geometry point-of-view as inner and outer edges have inverse orientations. But indeed probably not what the user expects...
Re: Inconsistent Chamfer behaviour when face selected
If you are proposing a PR then it is important to thoroughly test this on various cases. Operating on a face that was not selected could have unintended consequences in some cases.troyp76 wrote: ↑Thu Sep 09, 2021 2:11 pm To apply the chamfer consistently the code around FeatureChamfer.cpp: Line 148 would need to be changed so the chamfer distance is applied along the face that was not originally selected.
Before attempting to make this change does anyone see an issue with this approach?
Gene
Re: Inconsistent Chamfer behaviour when face selected
Not sure you caught well the issue. The fact is that if you select a face that has an "hole" and chamfer it, the outer edge is chamfered with 'alpha' angle, while the inner edge is chamfered with complementary angle '90°-alpha'. Of course if you use 45° as a chamfer angle, it's not visible.
Re: Unexpected Chamfer behaviour when face selected
Yes I agree from a programmatic perspective it is being applied consistently but from user perspective it is unexpected.
(title changed to reflect this)
I created another quick test that shows the issue also happens on vertical faces so it seems like a broader issue.
For comparison I tried the same operation in two other CAD systems. (FreeCAD is on the left)
The two other systems applied the distance along the same face. (either the selected face or the other face.)
FreeCAD applies the distance along both faces which I would argue is not useful and the user would need to fall back to manually clicking all edges to control the flip direction.
(Sorry not sure of the correct terminology. )
Re: Unexpected Chamfer behaviour when face selected
We are aligned. No doubt that there is room for improvement there.
Let's wait a bit if someone with some spare time dives in. If not, we can open a tracker ticket in a few days to keep trace of this.
Let's wait a bit if someone with some spare time dives in. If not, we can open a tracker ticket in a few days to keep trace of this.
Re: Unexpected Chamfer behaviour when face selected
Just my 2 cts, I know a big CAD system where the behaviour is similar with FreeCAD, same issue, since more than 20 years. That make me think the fix is not trivial.
BTW you mention that others CAD systems have a better behaviour and that's interesting.
I fully agree with you, any fix would be a great improvment. I hope some developper will be inspired
Re: Inconsistent Chamfer behaviour when face selected
I think I caught the issue correctly. My concern is for related shapes that are not donuts. For example, a U-shaped cutout may have similar behavior. I am not the least bit opposed to a proper fix; just a quick fix that breaks something else.openBrain wrote: ↑Fri Sep 10, 2021 7:21 am Not sure you caught well the issue. The fact is that if you select a face that has an "hole" and chamfer it, the outer edge is chamfered with 'alpha' angle, while the inner edge is chamfered with complementary angle '90°-alpha'. Of course if you use 45° as a chamfer angle, it's not visible.
Proposing to operate on the unselected face may work out fine, but the wording sounds scary.
Gene
Re: Inconsistent Chamfer behaviour when face selected
Please don't be scared, my wording was only intended to start the discussion before attempting any development effort which of course would need to be tested and reviewed.GeneFC wrote: ↑Fri Sep 10, 2021 7:16 pm
I think I caught the issue correctly. My concern is for related shapes that are not donuts. For example, a U-shaped cutout may have similar behavior. I am not the least bit opposed to a proper fix; just a quick fix that breaks something else.
Proposing to operate on the unselected face may work out fine, but the wording sounds scary.
Also the suggestion was based on the existing code where it already operates on the unselected face if the orientation is flipped by the user. eg the second GIF showing the manually selected edges and the orientation being flipped.
Will wait a couple of days as openBrain suggested to see if others chime in, otherwise from the feedback and further investigation it seems worthwhile having a go at fixing it.
I anticipate the fix will involve selecting the correct flip orientation for the discovered edges (from the selected face) rather than fundamentally changing how the chamfer operation works.
Gives me an excuse to learn more about FreeCAD C++ development ...
Re: Unexpected Chamfer behaviour when face selected
Finding my way around the code and now have an initial concept working.
Still a lot to do but it's a start.
Still a lot to do but it's a start.