'z_finish_step must be less than step_down' ??

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!
Post Reply
User avatar
freman
Veteran
Posts: 2201
Joined: Tue Nov 27, 2018 10:30 pm

'z_finish_step must be less than step_down' ??

Post by freman »

Hi,

I'm trying to do what seems like a fairly simple profile path. Starts at -2mm, steps 1mm and ends are -11.75mm

Expecting passes at minus 2 and each mm until minus 11, and a finish at 11.75 mm

Why is this creating an internal problem finding the last step? To me that seems to be 0.75mm which is indeed less than step_down

Bug ??

TIA

Code: Select all

_customDepthParams
    cdp = PathUtils.depth_params(
  File "~/freecad-build/Mod/Path/PathScripts/PathUtils.py", line 792, in __init__
    raise ValueError('z_finish_step must be less than step_down')
<class 'ValueError'>: z_finish_step must be less than step_down
OS: Fedora 34 (Thirty Four) (LXQt//usr/share/xsessions/lxqt)
Word size of FreeCAD: 64-bit
Version: 0.20.26155 (Git)
Build type: Release
Branch: master
Hash: 0926a4148bcff11249fd4f56bc30256102ffe105
Python version: 3.9.7
Qt version: 5.15.2
Coin version: 4.0.0a
OCC version: 7.5.0
Locale: English/United Kingdom (en_GB)
Attachments
z-depthspng.png
z-depthspng.png (38.28 KiB) Viewed 1551 times
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: 'z_finish_step must be less than step_down' ??

Post by sliptonic »

Stepdown shouldn't be a negative number. If that was computed automatically, there's a bug somewhere.
User avatar
freman
Veteran
Posts: 2201
Joined: Tue Nov 27, 2018 10:30 pm

Re: 'z_finish_step must be less than step_down' ??

Post by freman »

Ah thanks, a step down of plus one mm.

I should have spotted that. I've done enough of these paths.

I edited by hand , rubbed whatever was there and then went with the logic of negative space.

IMO, that should have been caught earlier. Either the input widget ( which won't even let me enter "12." instead of 12.0 ) could block negatives. Alternatively, since positive step would never seem to make sense it should be trapped before it confuses the algo.

Just before where it barfed, it could check for a positive number and either invert negatives or throw a meaningful message about negative steps instead the the cryptic thing it does show.

That this is the step magnitude rather than the step seems a bit confused but we're stuck with that now to prevent breaking everyone's files.

Quietly multiplying by -1 would be simplest. Though trapping incorrect input when it is done would seem best.

;)
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: 'z_finish_step must be less than step_down' ??

Post by sliptonic »

It needs to be addressed in a couple places. The task panel shouldn't allow a negative input. The property also shouldn't because the user might input the value from the property pane or use an expression that evaluates to a negative number. Then the depthparams object should test and raise an exception for a negative value. This because it might be used in user scripts.
User avatar
sliptonic
Veteran
Posts: 3457
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: 'z_finish_step must be less than step_down' ??

Post by sliptonic »

the depth_params helper object already switches all the values to positive integers. However, it tests and raises this particular error first. I'll fix that one if you want to focus on the UI side.
Post Reply