PathEngrave typo makes it not run?

Here's the place for discussion related to CAM/CNC and the development of the Path module.
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

PathEngrave typo makes it not run?

Postby roivai » Mon Dec 04, 2017 6:22 pm

PathEngrave is not working right now. It seems that during some larger refactoring at here obj.StepDown was renamed to obj.OpStepDown at opSetDefaultValues but is still referred as obj.StepDown elsewhere. This generates an error when trying to create engraving op.
Fix is available here:
https://github.com/pekkaroi/FreeCAD/com ... 7ddd6d36f9
mlampert
Posts: 1335
Joined: Fri Sep 16, 2016 9:28 pm

Re: PathEngrave typo makes it not run?

Postby mlampert » Mon Dec 04, 2017 6:56 pm

roivai wrote:
Mon Dec 04, 2017 6:22 pm
PathEngrave is not working right now. It seems that during some larger refactoring at here obj.StepDown was renamed to obj.OpStepDown at opSetDefaultValues but is still referred as obj.StepDown elsewhere. This generates an error when trying to create engraving op.
Fix is available here:
https://github.com/pekkaroi/FreeCAD/com ... 7ddd6d36f9
The way it's supposed to work is that OpStepDown gets assigned the value that the OP calculates. The actual value used is defined by the expression assigned to StepDown (the default expression is just to use "OpStepDown"). So the current implementation is correct, or should be.

What is it that doesn't work?
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: PathEngrave typo makes it not run?

Postby roivai » Mon Dec 04, 2017 6:59 pm

When trying to add engrave op, I get this:

Code: Select all

Running the Python command 'Path_Engrave' failed:
Traceback (most recent call last):
  File "/home/pekka/builds/FreeCAD/freecad-build2/Mod/Path/PathScripts/PathOpGui.py", line 957, in Activated
    return Create(self.res)
  File "/home/pekka/builds/FreeCAD/freecad-build2/Mod/Path/PathScripts/PathOpGui.py", line 923, in Create
    obj  = res.objFactory(res.name)
  File "/home/pekka/builds/FreeCAD/freecad-build2/Mod/Path/PathScripts/PathEngrave.py", line 198, in Create
    proxy = ObjectEngrave(obj)
  File "/home/pekka/builds/FreeCAD/freecad-build2/Mod/Path/PathScripts/PathOp.py", line 152, in __init__
    if self.setDefaultValues(obj):
  File "/home/pekka/builds/FreeCAD/freecad-build2/Mod/Path/PathScripts/PathOp.py", line 276, in setDefaultValues
    self.opSetDefaultValues(obj)
  File "/home/pekka/builds/FreeCAD/freecad-build2/Mod/Path/PathScripts/PathEngrave.py", line 193, in opSetDefaultValues
    obj.OpStepDown = obj.OpStartDepth.Value - obj.OpFinalDepth.Value

'FeaturePython' object has no attribute 'OpStepDown'
mlampert
Posts: 1335
Joined: Fri Sep 16, 2016 9:28 pm

Re: PathEngrave typo makes it not run?

Postby mlampert » Mon Dec 04, 2017 7:02 pm

<strike>That's bad - it should be "OpToolDiameter" - my bad.</strike>

EDIT: not, it shouldn't be OpToolDiameter - which obviously should be the Tool diameter - doh!
The idea was that the constraint values are not being set by the OP anymore, unless the user wants to use that value (through an expression).
roivai
Posts: 117
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: PathEngrave typo makes it not run?

Postby roivai » Mon Dec 04, 2017 7:13 pm

OK - I'm more confused than ever. :)

But good, you know now and my way of fixing it was totally wrong, so I silently remove that branch and try to study how SetupSheet works. ;)
mlampert
Posts: 1335
Joined: Fri Sep 16, 2016 9:28 pm

Re: PathEngrave typo makes it not run?

Postby mlampert » Mon Dec 04, 2017 7:14 pm

One of the problems is that assigning a value to StepDown can have "interesting" effects if there is also an expression assigned to the property. The way expressions work is that they assign a value to the property during "recompute". So depending an who set the value last (the expression or setDefaultValues) that's the value being used by the OP.

I think the best solution here would be to remove that line entirely and leave it up to the user to set a StepDown value or expression that gives the desired behaviour.
mlampert
Posts: 1335
Joined: Fri Sep 16, 2016 9:28 pm

Re: PathEngrave typo makes it not run?

Postby mlampert » Mon Dec 04, 2017 7:16 pm

roivai wrote:
Mon Dec 04, 2017 7:13 pm
OK - I'm more confused than ever. :)
You and me both - expressions in FC turned out to have "more presonality" than I thought and it was quite a ride to adjust my mental model and finally end up with stable values.
mlampert
Posts: 1335
Joined: Fri Sep 16, 2016 9:28 pm

Re: PathEngrave typo makes it not run?

Postby mlampert » Mon Dec 04, 2017 11:42 pm

Removed the offending code: PR-1138