FreeCAD_SheetMetal icon indicating copy to clipboard operation
FreeCAD_SheetMetal copied to clipboard

Can't create new bend/junction

Open kisolre opened this issue 4 months ago • 8 comments

Describe your issue

I was not able to add new bends to an already created body that already had some bends added. I was able to edit the existing bends but not add a new ones. I tried with a blank file ant the error persists. Tried using old FreeCAD (0.21.2) - still no go. To test and reproduce I renamed my FC user folder (as fresh start as possible), installed SheetMetal WB, created new file, switched to SheetMetal WB, added new base shape, selected a straight edge (right internal edge of the wider section) and tried to create new bend. This is the error I get: 16:42:24 pyException: Traceback (most recent call last): File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 138, in execute s = smSolidBend( ^^^^^^^^^^^^ File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 107, in smSolidBend return resultSolid ^^^^^^^^^^^ <class 'UnboundLocalError'>: cannot access local variable 'resultSolid' where it is not associated with a value 16:42:24 SolidBend: cannot access local variable 'resultSolid' where it is not associated with a value 16:42:40 pyException: Traceback (most recent call last): File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 138, in execute s = smSolidBend( ^^^^^^^^^^^^ File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 107, in smSolidBend return resultSolid ^^^^^^^^^^^ <class 'UnboundLocalError'>: cannot access local variable 'resultSolid' where it is not associated with a value 16:42:40 SolidBend: cannot access local variable 'resultSolid' where it is not associated with a value 16:42:49 pyException: Traceback (most recent call last): File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 138, in execute s = smSolidBend( ^^^^^^^^^^^^ File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 107, in smSolidBend return resultSolid ^^^^^^^^^^^ <class 'UnboundLocalError'>: cannot access local variable 'resultSolid' where it is not associated with a value 16:42:49 SolidBend: cannot access local variable 'resultSolid' where it is not associated with a value
Despite the error FC lets me confirm the dialog but there is no proper resulting solid and the feature is in error state.

FreeCAD version info + SheetMetal WB version

OS: Windows 11 build 22631
Architecture: x86_64
Version: 1.1.0dev.42885 (Git)
Build date: 2025/08/08 15:11:51
Build type: Release
Branch: main
Hash: 0cdf0af0c6f9f4c12ab7072064906626f86f6f98
Python 3.11.13, Qt 6.8.3, Coin 4.0.3, Vtk 9.3.1, boost 1_86, Eigen3 3.4.0, PySide 6.8.3
shiboken 6.8.3, xerces-c 3.2.5, IfcOpenShell 0.8.2, OCC 7.8.1
Locale: Bulgarian/Bulgaria (bg_BG)
Navigation Style/Orbit Style/Rotation Mode: CAD/Rounded Arcball/Window center
Stylesheet/Theme/QtStyle: FreeCAD.qss/FreeCAD Light/
Logical DPI/Physical DPI/Pixel Ratio: 96/113.268/1.25
Installed mods: 
  * sheetmetal 0.7.24

Put here any screenshots or videos (optional)

No response

kisolre avatar Aug 15 '25 13:08 kisolre

Please attach a sample file with instructions how to reproduce the issue. (please zip the file so github can accept it)

shaise avatar Aug 17 '25 04:08 shaise

As I already explained this happens even with the default base shape from SheetMetal WB so here is a file with that, screenshots of the edge selected, resulting error when Make Bend is pressed, error message from report view:

13:39:47  pyException: Traceback (most recent call last):
  File "C:\UserData\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 138, in execute
    s = smSolidBend(
        ^^^^^^^^^^^^
  File "C:\UserData\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 104, in smSolidBend
    resultSolid = MainObject.makeFillet(radius, InnerEdgesToBend)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<class 'Part.OCCError'>: class StdFail_NotDone BRep_API: command not done
13:39:47  SolidBend: class StdFail_NotDone BRep_API: command not done
13:40:17  pyException: Traceback (most recent call last):
  File "C:\UserData\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 138, in execute
    s = smSolidBend(
        ^^^^^^^^^^^^
  File "C:\UserData\FreeCAD\Mod\sheetmetal\.\SheetMetalBend.py", line 107, in smSolidBend
    return resultSolid
           ^^^^^^^^^^^
<class 'UnboundLocalError'>: cannot access local variable 'resultSolid' where it is not associated with a value
13:40:17  SolidBend: cannot access local variable 'resultSolid' where it is not associated with a value

[SampleFile.zip](https://github.com/user-attachments/files/21821779/SampleFile.zip)
<img width="1870" height="1000" alt="Image" src="https://github.com/user-attachments/assets/ed76d2f9-3c2c-4f9c-915b-8a4b9421fec4" />
<img width="1874" height="998" alt="Image" src="https://github.com/user-attachments/assets/053f9dd8-4f44-4cc4-8a82-5bf7331bc0e1" />

Triage edit: 3 backticks are needed for fenced code

kisolre avatar Aug 17 '25 10:08 kisolre

@luzpaz It seems that attachments are missing after your edit ?!?

kisolre avatar Aug 19 '25 09:08 kisolre

Seems indeed the files are missing The reason I asked for a sample is because I just cant reproduce it.

Image Image

shaise avatar Aug 21 '25 08:08 shaise

Oh! I get it! You are using the wrong function... the AddBend function turns a solid corner into a bend:

Image

you should use this one:

Image

shaise avatar Aug 21 '25 08:08 shaise

It is as you said. My bad. I was wandering why there are so few options in the task panel :) This issue could be closed then. Maybe this can be better captured and more meaningful error message be displayed - "Can't make bend from selection" or something along those lines?

kisolre avatar Aug 21 '25 09:08 kisolre

I definitely agree the error messages have room for improvements...

shaise avatar Aug 21 '25 09:08 shaise

Thank you! Not sure relying on open issues is the best way to solve things, but I've been banging my head against this exact problem since yesterday 😀

I realise it's difficult to explain these things concisely. I wonder if some wording like "Convert to bend" or your "Turn solid corner into a bend" on the tooltip would help. I think that would've been enough for me to realise it wasn't what I was after and then hunt further and (hopefully) find the Make Wall option (I'd managed to forget that in a whole week since happily working on the first part of my design 🤦)

amcewen avatar Nov 08 '25 21:11 amcewen