knipknap / better-tool-library

A FreeCAD addon and command line tool for managing tool libraries
MIT License
22 stars 11 forks source link

ValueError: An upper bound is less than the corresponding lower bound. #6

Closed sgofferj closed 1 year ago

sgofferj commented 1 year ago

FreeCAD 0.21.0 AppImage Ubuntu 22.04.3 LTS

Opened a tool in the tool library editor and went to the Feeds and Speeds tab

18:21:45  Traceback (most recent call last):
18:21:45    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/ui/feedsandspeeds.py", line 40, in run
18:21:45      self.worker.start()
18:21:45    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/ui/feedsandspeeds.py", line 30, in start
18:21:45      self.result = self.fc.start(progress_cb=progress_cb)
18:21:45    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 339, in start
18:21:45      results = self.calculate(progress_cb, iterations=iterations)
18:21:45    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 320, in calculate
18:21:45      self.optimize()
18:21:45    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 293, in optimize
18:21:45      result = minimize(self._evaluate_point,
18:21:45    File "/tmp/.mount_FreeCATUTG9K/usr/lib/python3.10/site-packages/scipy/optimize/_minimize.py", line 643, in minimize
18:21:45      bounds = _validate_bounds(bounds, x0, meth)
18:21:45    File "/tmp/.mount_FreeCATUTG9K/usr/lib/python3.10/site-packages/scipy/optimize/_minimize.py", line 996, in _validate_bounds
18:21:45      raise ValueError(msg)
18:21:45  ValueError: An upper bound is less than the corresponding lower bound.
18:21:46  Traceback (most recent call last):
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/ui/feedsandspeeds.py", line 40, in run
18:21:46      self.worker.start()
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/ui/feedsandspeeds.py", line 30, in start
18:21:46      self.result = self.fc.start(progress_cb=progress_cb)
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 339, in start
18:21:46      results = self.calculate(progress_cb, iterations=iterations)
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 320, in calculate
18:21:46      self.optimize()
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 293, in optimize
18:21:46      result = minimize(self._evaluate_point,
18:21:46    File "/tmp/.mount_FreeCATUTG9K/usr/lib/python3.10/site-packages/scipy/optimize/_minimize.py", line 643, in minimize
18:21:46      bounds = _validate_bounds(bounds, x0, meth)
18:21:46    File "/tmp/.mount_FreeCATUTG9K/usr/lib/python3.10/site-packages/scipy/optimize/_minimize.py", line 996, in _validate_bounds
18:21:46      raise ValueError(msg)
18:21:46  ValueError: An upper bound is less than the corresponding lower bound.
18:21:46  Traceback (most recent call last):
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/ui/feedsandspeeds.py", line 40, in run
18:21:46      self.worker.start()
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/ui/feedsandspeeds.py", line 30, in start
18:21:46      self.result = self.fc.start(progress_cb=progress_cb)
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 339, in start
18:21:46      results = self.calculate(progress_cb, iterations=iterations)
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 320, in calculate
18:21:46      self.optimize()
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 293, in optimize
18:21:46      result = minimize(self._evaluate_point,
18:21:46    File "/tmp/.mount_FreeCATUTG9K/usr/lib/python3.10/site-packages/scipy/optimize/_minimize.py", line 643, in minimize
18:21:46      bounds = _validate_bounds(bounds, x0, meth)
18:21:46    File "/tmp/.mount_FreeCATUTG9K/usr/lib/python3.10/site-packages/scipy/optimize/_minimize.py", line 996, in _validate_bounds
18:21:46      raise ValueError(msg)
18:21:46  ValueError: An upper bound is less than the corresponding lower bound.
18:21:46  Traceback (most recent call last):
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/ui/feedsandspeeds.py", line 40, in run
18:21:46      self.worker.start()
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/ui/feedsandspeeds.py", line 30, in start
18:21:46      self.result = self.fc.start(progress_cb=progress_cb)
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 339, in start
18:21:46      results = self.calculate(progress_cb, iterations=iterations)
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 320, in calculate
18:21:46      self.optimize()
18:21:46    File "/home/sgofferj/.local/share/FreeCAD/Mod/btl/./btl/feeds/calc.py", line 293, in optimize
18:21:46      result = minimize(self._evaluate_point,
18:21:46    File "/tmp/.mount_FreeCATUTG9K/usr/lib/python3.10/site-packages/scipy/optimize/_minimize.py", line 643, in minimize
18:21:46      bounds = _validate_bounds(bounds, x0, meth)
18:21:46    File "/tmp/.mount_FreeCATUTG9K/usr/lib/python3.10/site-packages/scipy/optimize/_minimize.py", line 996, in _validate_bounds
18:21:46      raise ValueError(msg)
18:21:46  ValueError: An upper bound is less than the corresponding lower bound.
knipknap commented 1 year ago

The most likely cause is an invalid input parameter, like a zero height cutting edge or a stickout that is too small. Could you make a screenshot of the tool properties and the feeds&speeds tab? Also it may help me to debug if you right click the results to show the hidden properties.

In any case, I would then try to make the error message more friendly.

knipknap commented 1 year ago

I just pushed an improvement already, with any luck the error message may now be better.

sgofferj commented 1 year ago

Screenshot_20230824_212103

Screenshot_20230824_212153

knipknap commented 1 year ago

I think the problem is the chipload unit. I cannot reproduce your problem, and when using "0.025 mm" for the chipload it works for me.

I assume you haven't updated BTL since you last tried? Because otherwise you should at least see a better error message.

knipknap commented 1 year ago

I pushed a fix for the micrometer unit issue. If you upgrade and try again the issue may be fixed.

sgofferj commented 1 year ago

It seems to work now, yes. The error appeared to have occurred only with tools I added in 0.19. When I add a new tool in 0.21 through the plugin, everything works fine.

sgofferj commented 1 year ago

WOW :fearful: 418mm/min at 7mm stepdown for a 1mm carbide splinter...

Screenshot_20230825_105709

Screenshot_20230825_105721

knipknap commented 1 year ago

Hmmm, that doesn't seem entirely unreasonable to me given the small WOC with a dual flute carbide cutter in 6061? The radial force is certainly close to the limit, but the calculation assumes ideal conditions (i.e. perfect rigidity of the machine, zero runout). Hence the recommendation to start with half the given DOC.

What are good feeds&speeds in your experience with this cutter, and what type of machine are you using?

sgofferj commented 1 year ago

I'm using a hobby-grade 3018 which I upgraded to MGN rails and a much better spindle. Certainly not perfect. But anything more than 0.1mm, MAYBE 0.2mm DOC, 0.25mm WOC, 300mm/m and the cutter breaks. That's a pretty good difference.

sgofferj commented 1 year ago

In any case, the original issue seems to be fixed, so feel free to close this! And thank you for your work! It helps me a lot in my hobby!

knipknap commented 1 year ago

Ahh, I see. That's how I started as well, but luckily was able to upgrade to a much better machine.

Yeah, no chance these parameters could possibly work in that case - most likely your spindle runout is the limiting factor. I may add some additional parameters to the machine dialog in the future, to allow for taking machine rigidity and runout into account.

Thanks for the bug report.