Thursday 11 December 2014

FreeCAD: Sheet metal tool "Add Wall"

 Thought not seen here, I work in the sheet metal workbench from time to time (last update), being my greater effort coding the unfold algorithm (related post). But I also work at the surrounding tools that this workbench needs, one of them is almost usable and is the reason of this post.

Add wall tool:


When I create the "dummy" shapes for testing the unfolding algorithm, the process is somewhat tedious. So I created this tool and developed it a bit to be easily integrated in the workbench in a future.

The utility of the tool is explained with this video:



Code can be found here

How to use it:

The script contains the function  "addWall", when calling it this are the possible input parameters:

thk = float:           Sheet thickness, 1.0 is the default value
bendR =  float:     Bend radius, default value is 3.0
alpha = float:       Angle of the new wall plane in reference to previous shape plane. 0 will give error (infinite bending radius needed ). By default 90º

L1 and L2 are better explained with a picture:


L1 and L2 values (float) modify the lengths noted by the white dimension marks. By default 0.0

Relief = boolean:  Create or not square relief slots (I think this is the correct name, but tell me if not) like this:


Relief slots have two parameters:

rlfWidth = float: The width of the relief, by default 0.5
rlfDepth = float: The depth of the relif, by default 1.0

Other parameters are:

inverted = boolean: Reverse bend direction, false by default
create = boolean:  This is to merge new wall with current object, true by default. Workbench utility
sketch = boolean: Automatically places a new sketch on new wall, false by default.


To use it, copy-paste the code at FreeCAD's  python console, select one suitable face to place a new wall and then type "addWall( arguments )".

It should work.


Bye!

7 comments:

  1. I get the following error:

    UnboundLocalError: local variable 'V_thDir' referenced before assignment

    whether I select a face beforehand or not. What could be the problem?

    ReplyDelete
  2. Well I'm a complete n00b in regard to Python programming but I've followed your orders about copy-pasting the code into the Python window and got the following as a result:

    >>> addWall( create = True, L1 = 0, L2 = 0 )
    Traceback (most recent call last):
    File "< input>", line 1, in
    File "< input>", line 13, in addWall
    UnboundLocalError: local variable 'V_thDir' referenced before assignment
    >>>

    (no space before 'input' of course)

    ReplyDelete
  3. Hello.

    What is the thickness of your origin shape? By default is 1.0mm, if yours is different, you should specify it this way: addWall( thk = YOURTHICKNESS, create=True, L1=0, L2=0)

    Hope it helps

    ReplyDelete
  4. Hi,
    first I want to thank you for your great work! The script is awesome and makes FreeCAD much more useable for me.
    But I would like to know why the extrusion altitude is set to the edge length of the exisiting sheet, this makes it a little more work.
    I added a new argument "manExtLength" to your script and replaced edge.Length for it, to set the extrusion length manually.

    Also, is it possible to add an reducing angle (like if you bend non-rectangular sheets?)? Maybe it could be an boolean, to determine if L1 and L2 are the wideness of an notch (like in your script) or a slant?

    Thanks again and kind greetings.

    PS: Please excuse if my english is bad.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Hello Köbes, thanks for your kind words and for taking the effort of reading my spaghetti code :D

    1- The extrusion is limited to the edge length because it was the most neutral, less error prone measure that I could thought. Appart from this, there is no other reason for it.

    2- With that angle specification, do you refer to this? : http://1.bp.blogspot.com/-tX3mEOmpEEA/VOe4nxVJoYI/AAAAAAAABcQ/UE2tcG1hArA/s1600/Captura%2Bde%2Bpantalla%2Bde%2B2015-02-20%2B23%3A43%3A09.png

    There is a more advanced-complex addWall tool that allows you to build directly the face using an sketch, instead of modifiying a rectangular one (The shape on the linked picture is made with it) This new version has also an option to place the bend inside/outside the original edge, plus the current AddWall tool features. The problem is that is very buggy, but I may post it one day if I decide to continue with its development.


    Regards.

    ReplyDelete
  7. Hi JMG,
    Thank you for your answer; I meant exactly something like in the picture. Such a tool supporting sketches would be totally awesome! I hope you will find some time to finish this version soon. :)
    Greetings

    ReplyDelete