Creating a 2D path job for ShapeStrings fails

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!
mclane
Posts: 8
Joined: Wed Feb 12, 2020 5:19 pm

Creating a 2D path job for ShapeStrings fails

Post by mclane »

Hello,

I tried to repoduce the work shown in this YouTube video:
https://www.youtube.com/watch?v=mC21T943auk

However, when I want to create a path job, I get the following error:

Code: Select all

15:20:50  Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathStock.py", line 153, in onChanged
    self.execute(obj)
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathStock.py", line 147, in execute
    shape = Part.makeBox(self.length, self.width, self.height, self.origin)
<class 'ValueError'>: height of box too small
15:20:50  PathJobGui.ERROR: height of box too small
15:20:50  Traceback (most recent call last):
15:20:50    File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 1561, in Create
    obj = PathJob.Create("Job", base, template)
15:20:50    File "/usr/lib/freecad/Mod/Path/PathScripts/PathJob.py", line 718, in Create
    obj.Proxy = ObjectJob(obj, models, templateFile)
15:20:50    File "/usr/lib/freecad/Mod/Path/PathScripts/PathJob.py", line 244, in __init__
    obj.Stock = PathStock.CreateFromTemplate(obj, json.loads(stockTemplate))
15:20:50    File "/usr/lib/freecad/Mod/Path/PathScripts/PathStock.py", line 390, in CreateFromTemplate
    return CreateFromBase(job, neg, pos, placement)
15:20:50    File "/usr/lib/freecad/Mod/Path/PathScripts/PathStock.py", line 267, in CreateFromBase
    obj.Proxy.execute(obj)
15:20:50    File "/usr/lib/freecad/Mod/Path/PathScripts/PathStock.py", line 147, in execute
    shape = Part.makeBox(self.length, self.width, self.height, self.origin)
15:20:50  ValueError: height of box too small
15:20:50  
The project file is simple: it just contains a ShapeString object (as in the YT video), but I have attached it. What is wrong here?
Thanks for any help.

My FreeCAD installation:
OS: Manjaro Linux (XFCE/xfce)
Word size of FreeCAD: 64-bit
Version: 0.20.25697 (Git)
Build type: Release
Branch: master
Hash: da918350c9efbd7751bd7e48a71cd4bded571500
Python version: 3.9.6
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: German/Germany (de_DE)
Attachments
test.FCStd
(9.71 KiB) Downloaded 53 times
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Creating a 2D path job for ShapeStrings fails

Post by GeneFC »

I am not sure what went wrong, and I did not watch the video, but I had no problem with creating a Job and a path.

Capture.PNG
Capture.PNG (13.09 KiB) Viewed 2987 times

I just selected the ShapeString, selected the Job icon, accepted all defaults, and then selected the Engrave operation. I did not try to set any parameters.

OS: Windows 7 Version 6.1 (Build 7601: SP 1)
Word size of FreeCAD: 64-bit
Version: 0.20.25645 (Git)
Build type: Release
Branch: master
Hash: 37d9757399b4c2ec30318eb88d7cd7c508246345
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)

Gene
mclane
Posts: 8
Joined: Wed Feb 12, 2020 5:19 pm

Re: Creating a 2D path job for ShapeStrings fails

Post by mclane »

Thanks for trying to reproduce it. The error occurs when I want to create the path job.

You are using a slightly older Python version (3.8.6+) compared to mine (3.9.6), maybe the problem comes from there?
bmsaus4ax
Posts: 258
Joined: Sat Nov 14, 2020 9:16 pm
Location: Bargara, Queensland, Australia UTC+10

Re: Creating a 2D path job for ShapeStrings fails

Post by bmsaus4ax »

mclane wrote: Thu Sep 16, 2021 1:27 pm Hello,

I tried to repoduce the work shown in this YouTube video:
https://www.youtube.com/watch?v=mC21T943auk

However, when I want to create a path job, I get the following error:
[
I also use a Linux version and get the error you do.

I find if you create the path job with both your job model and the ShapeString selected the tool path will be produced.
In preparation, position the ShapeString on the surface of the job. (Z offset either the job or ShapeString)
The Depths, Final Depth setting will need to be set to the desired value.
Attached modification of your file to illustrate for V-Carve and Engrave.
.
If at some stage you get the following error, you need to save your file and close out of FreeCAD completely and restart. The saved file will then work again.

Code: Select all

Free Select
Running the Python command 'Path_Simulator' failed:
Traceback (most recent call last):
  File "/tmp/.mount_FreeCAzGNuYe/usr/Mod/Path/PathScripts/PathSimulatorGui.py", line 588, in Activated
    pathSimulation.Activate()
  File "/tmp/.mount_FreeCAzGNuYe/usr/Mod/Path/PathScripts/PathSimulatorGui.py", line 103, in Activate
    self.onJobChange()
  File "/tmp/.mount_FreeCAzGNuYe/usr/Mod/Path/PathScripts/PathSimulatorGui.py", line 459, in onJobChange
    for op in j.Operations.OutList:

Cannot access attribute 'Operations' of deleted object
.
.
OS: Ubuntu 20.04.3 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.25645 (Git) AppImage
Build type: Release
Branch: master
Hash: 37d9757399b4c2ec30318eb88d7cd7c508246345
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: English/Australia (en_AU)
Attachments
test_mod.FCStd
(65.86 KiB) Downloaded 49 times
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Creating a 2D path job for ShapeStrings fails

Post by chrisb »

I can confirm the issue, I see the message in Report view. It vanishes if I extend the Z of the stock by some positive value.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
DaveHarm
Posts: 8
Joined: Tue Jul 13, 2021 3:50 pm
Location: S. E. Michigan

Re: Creating a 2D path job for ShapeStrings fails

Post by DaveHarm »

I am new user of FreeCAD version 0.19 on Linux Mint and just getting started with the Path toolbox and am seeing the "length of box too small" error also.
It looks like maybe a round-off error? The amount the box is too small is tiny but appears visible at both the tip of my model and the bottom.
I'm not a coder but are self.length, self.width and self.height returning values that round down for some reason? Is there a fix somewhere?
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Creating a 2D path job for ShapeStrings fails

Post by sliptonic »

chrisb wrote: Fri Sep 17, 2021 7:11 am I can confirm the issue, I see the message in Report view. It vanishes if I extend the Z of the stock by some positive value.
Will you test this again please? I'm unable to reproduce the issue but I'm still on Python 3.8.10
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Creating a 2D path job for ShapeStrings fails

Post by chrisb »

sliptonic wrote: Mon Mar 07, 2022 9:16 pm Will you test this again please? I'm unable to reproduce the issue but I'm still on Python 3.8.10
Tested and works now without issue.

OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.20.27770 (Git)
Build type: Release
Python 3.9.10, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: C/Default (C)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
agren
Posts: 40
Joined: Sat Apr 20, 2019 7:37 am

Re: Creating a 2D path job for ShapeStrings fails

Post by agren »

Unless I've misunderstood the OP I believe I'm still seeing this on:

Code: Select all

OS: Ubuntu 20.04.4 LTS (MATE/mate)
Word size of FreeCAD: 64-bit
Version: 0.20.27968 (Git)
Build type: Debug
Branch: master
Hash: bda12907dee4fe3f0e7dec8f7e09e098fc5036e4
Python 3.8.10, Qt 5.12.8, Coin 4.0.0, OCC 7.5.2
Locale: English/United States (en_US)
Steps to reproduce:
Set Edit->Preferences->Path->Job Preferences->Setup
  1. Set Edit->Preferences->Path->Job Preferences->Setup
    • Stock: Enabled
    • Extend Models Bounding Box
    • Ext.X: 1 mm, 1 mm
    • Ext.Y: 1 mm, 1 mm
    • Ext.Z: 0 mm, 0 mm
    • Placement Disabled
  2. Create a 2D shape (Draft ShapeString or Sketcher sketch) on the XY plane
  3. Path->Job
  4. Select the 2D shape as model in the "Create Job" dialog
  5. Click OK
Result:
Job is not created and Job Edit panel is not shown
Error message

Code: Select all

...
16:24:47    File "/.../freecad-build/Mod/Path/PathScripts/PathStock.py", line 222, in execute
    shape = Part.makeBox(self.length, self.width, self.height, self.origin)
16:24:47  ValueError: height of box too small
Workaround:
The key part is the Ext.Z parameter in Edit->Preferences->Path->Job Preferences->Setup.
Setting it to != 0 so the stock gets a height > 0 solves the issue
User avatar
sliptonic
Veteran
Posts: 3459
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Creating a 2D path job for ShapeStrings fails

Post by sliptonic »

That makes sense and, in my opinion, is how it should work. with a 2D base object and a stock of 0 height the stock object can't control safe heights or retraction. If you're engraving something, how high would you expect the tool to retract between segments?

I suppose we could catch the error more elegantly and just not generate a path. What should be the correct behavior?
Post Reply