[SOLVED] Cuts Not Created As Expected from STEP

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
atclaus
Posts: 7
Joined: Mon Nov 22, 2021 3:35 am

[SOLVED] Cuts Not Created As Expected from STEP

Post by atclaus »

I learned from a separate post (thanks!) about bad geometry of overlapping parts. I think I am encountering the same thing again, this time with a step file of a speaker I downloaded from Adafruit's git. I did the same thing on this object when imported and get an error. However, I don't have an alternative to using it as I am trying to fit it into a recess. They supply STEP and f3d, but my understanding is FreeCAD only supports STEP. I could cut it in TinkerCAD.com properly by opening an STL version (STEP into FreeCAD and exporting an STL), but re-importing that STL doesn't work to cut in FreeCAD. Lost as to what is next. Thanks!
Attachments
Unnamed-speaker v002.stl
speaker exported from STEP in FreeCAD to STL
(340.12 KiB) Downloaded 14 times
3351 Enclosed Speaker 3W 4Ohm.step
Downloaded speaker file
(170.81 KiB) Downloaded 16 times
HASScasev001.FCStd
overall project with failed cuts
(397.14 KiB) Downloaded 17 times
Last edited by atclaus on Sun Nov 28, 2021 4:15 pm, edited 1 time in total.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Cuts Not Created As Expected from STEP

Post by chrisb »

This is rather a coplanar issue than a Step issue. I have slightly moved the imported objects and now the cut works. You can now minimize the movement, probably down to the µm range.

Besides: it is always appreciated if uploaded files don't contain any additional stuff besides the issue itself. Describe precisely what fails and what you expect. Talking about a cut if your model contains lots of them or talking about your expectations without naming them costs (lots) of time for every helper looking at your problem, while it costs you only once the additional effort.
Attachments
SnipScreenshot-a8a8e6.png
SnipScreenshot-a8a8e6.png (31.34 KiB) Viewed 1210 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
atclaus
Posts: 7
Joined: Mon Nov 22, 2021 3:35 am

Re: Cuts Not Created As Expected from STEP

Post by atclaus »

Thanks for the advice. I should have known that re single problem to the file... Learned (I hope).

However, I don't really understand the definition of co-planar issue. Did a little digging. Got it to work, but cannot make sense of when it does and does not. Would you mind explaining the co-planar issue a little more (or pointing me to a better resource than what I searched)? Thanks!
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Cuts Not Created As Expected from STEP

Post by drmacro »

atclaus wrote: Sat Nov 27, 2021 4:09 pm Thanks for the advice. I should have known that re single problem to the file... Learned (I hope).

However, I don't really understand the definition of co-planar issue. Did a little digging. Got it to work, but cannot make sense of when it does and does not. Would you mind explaining the co-planar issue a little more (or pointing me to a better resource than what I searched)? Thanks!
If you create two sketches and draw a square in each.

If the left side of square A is at 10 on the X and the right side of square B is 10 on the X, then you pad both. The face created by both will be coplaner.

The math behind it is more than this explaination: but, you can think of this causing a divide by zero issue, since Ax-Bx =0, so trying to refine that face won't converge.

Changing Ax to 10.001 can fix this. Because of floating point round off, the actual value required to overcome the "coplaner-ness" is not a finite percentage for all cases.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Cuts Not Created As Expected from STEP

Post by chrisb »

"Coplanar issue" is the slightly unprecise notion used here for phenomena occurring with coplanar faces, seam lines lying on each other or similar. They come from the geometric kernel, which is provided by the OpenCascade (OCC) company, it is (mostly) out of control of the FreeCAD developers.

From what I see I guess that it is an issue related to the finite computing precision: while in mathematics two planes can only be related in one of the following ways:
- they are parallel (no points in common)
- they are equal (all points in common)
- they cut each other (having a line in common)

Things are different on real computers. Planes being seemingly equal don't share all points, sometimes it is one of them lying above the other, and sometimes it is vice versa.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
atclaus
Posts: 7
Joined: Mon Nov 22, 2021 3:35 am

Re: Cuts Not Created As Expected from STEP

Post by atclaus »

Thanks ya'll. So the two speakers were combined which resulted in some planes of them intersecting, but not identically, therefore co-planar issue?
drmacro
Veteran
Posts: 8862
Joined: Sun Mar 02, 2014 4:35 pm

Re: Cuts Not Created As Expected from STEP

Post by drmacro »

atclaus wrote: Sun Nov 28, 2021 4:14 pm Thanks ya'll. So the two speakers were combined which resulted in some planes of them intersecting, but not identically, therefore co-planar issue?
Hmm...sort of.

Imagine the following. (Note: this for illustration only, it would fail in reality)
  • New Body, new sketch, draw a 10mm diameter circle.
  • Now Pad this sketch 20mm. We'll refer to this as BodyA.
  • New Body, new sketch, draw a 10mm diameter circle.
  • Now Pad this sketch 20mm in the same direction as above. We'll refer to this as BodyB
  • Now select a point on the surface of the BodyA. It's radius value should be exactly 5mm, but because of floating point the value is actually maybe 5.000006.
  • Now pick the same point on the surface BodyB. This point's radius value should be exactly 5mm, but because of floating point the value is actually maybe 5.00009.
The surfaces of BodyA and B are both supposed to be a radius of 5mm. And if they were, the two would be coplaner (i.e. they would represent the same surface at the same place in space. But, Because of the way floating point works (and the math being done on the circles) they aren't exactly, so it confuses the algorithm.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Post Reply