Fehler im Konturfräsen V17 ?

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Fehler im Konturfräsen V17 ?

Post by mlampert »

Yeah I noticed that - there's definitely something wrong.
User avatar
wandererfan
Veteran
Posts: 6326
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by wandererfan »

sliptonic wrote:Look at the image I added on the ticket. Besides the extra internal line (which shouldn't be there) theres also a small spurious segment in the top corner. This wreaked havoc with that part contour.
At first glance there's nothing in findShapeOutline() that uses Vector2d or BoundBox2d. The outline in Taschen.fcstd is still wrong (should be rectangle), but I'm not sure the fix for issue #2858 broke it.

Can you post the file that generated the snapshots, please?

wf
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by sliptonic »

attached.

I select the Pocket002 object and run this macro

Code: Select all

import TechDraw
from FreeCAD import Vector

sel = Gui.Selection.getSelectionEx()[0]
obj = sel.Object.Shape

contourwire = TechDraw.findShapeOutline(obj,1, Vector(0,0,1))
myObject = FreeCAD.ActiveDocument.addObject("Part::Feature","myObject")
myObject.Shape = contourwire
Attachments
profiletorturetest.fcstd
(124.31 KiB) Downloaded 22 times
User avatar
wandererfan
Veteran
Posts: 6326
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by wandererfan »

Nasty, nasty bug. Involves comparison of bounding boxes and this OCC issue: http://opencascade.blogspot.ca/2009/04/ ... g-box.html

Doesn't seem to be strictly deterministic. I got this from ProfileTortureTest.fcstd:
ProfileTortureTest Outline
ProfileTortureTest Outline
OutlineWire0.png (2.62 KiB) Viewed 1750 times
But this from Taschen.fcstd:
Taschen Outline
Taschen Outline
TaschenOutlineWire0.png (2.53 KiB) Viewed 1750 times
Anyway, the fix is to not use the bounding boxes to determine relative sizes, but to use the actual enclosed area of the wires.
MIght be a little slower, but should be accurate.

PR will be along shortly.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by wmayer »

The ticket issue #0002858 was opened by wandererfan but I am not sure if there was real problem with the old behaviour. However, it looks like there is now a problem with the new behaviour.

So, for me it's OK to revert the changes and introduce a method isEqual(Vector2d, double) where a tolerance can be passed. IIRC for example the gp_Pnt class of OCC also does an exact check of the coordinates.
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by sliptonic »

I like that.
The new behavior is causing a problem in several of the Path operations that don't use the TechDraw findShapeOutline function. I've been trying to isolate exactly where but it's eluding me so far.
User avatar
wandererfan
Veteran
Posts: 6326
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by wandererfan »

wmayer wrote:The ticket issue #0002858 was opened by wandererfan but I am not sure if there was real problem with the old behaviour. However, it looks like there is now a problem with the new behaviour.

So, for me it's OK to revert the changes and introduce a method isEqual(Vector2d, double) where a tolerance can be passed. IIRC for example the gp_Pnt class of OCC also does an exact check of the coordinates.
This is the change that breaks findShapeOutline:
in Base/Vector3D.h
- static inline float_type epsilon() { return FLT_EPSILON; }
+ static inline float_type epsilon() { return DBL_EPSILON; }

FLT_EPSILON 1E-5
static const Standard_Real Precision_Confusion = 1.e-7;
DBL_EPSILON 1E-9
Our test for zero is finer than our calculations.

As far as I can tell Path/CAM doesn't use the FreeCAD Vector2d, so this is probably causing the trouble there too.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by wmayer »

This is the change that breaks findShapeOutline:
in Base/Vector3D.h
- static inline float_type epsilon() { return FLT_EPSILON; }
+ static inline float_type epsilon() { return DBL_EPSILON; }
Using FLT_EPSILON for a Vector3d which internally uses double (not float) is too rough. So, I will revert the above changes and introduce an isEqual method where you can pass an arbitrary tolerance. This way we will be consistent to OCC's gp_Pnt class.
User avatar
wandererfan
Veteran
Posts: 6326
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by wandererfan »

Comparison with tolerance is a good addition to Vector2d and Vector3d.
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Fehler im Konturfräsen V17 ?

Post by sliptonic »

wmayer wrote:
This is the change that breaks findShapeOutline:
in Base/Vector3D.h
- static inline float_type epsilon() { return FLT_EPSILON; }
+ static inline float_type epsilon() { return DBL_EPSILON; }
Using FLT_EPSILON for a Vector3d which internally uses double (not float) is too rough. So, I will revert the above changes and introduce an isEqual method where you can pass an arbitrary tolerance. This way we will be consistent to OCC's gp_Pnt class.
Has this been reverted yet? Should I create an issue to track it?
Post Reply