shaise / freecad_sheetmetal Goto Github PK
View Code? Open in Web Editor NEWA simple sheet metal workbench for FreeCAD
Home Page: http://theseger.com/projects/2015/06/sheet-metal-addon-for-freecad/
License: GNU Lesser General Public License v2.1
A simple sheet metal workbench for FreeCAD
Home Page: http://theseger.com/projects/2015/06/sheet-metal-addon-for-freecad/
License: GNU Lesser General Public License v2.1
For helping mechanical operations, it would be nice to have bending lines in different color on unfold.
Hi,
while bending with no gap from a body (Part design next) : no issues as shown on picture below
while creating a bend with a gap, whatever the orientation i got this : the direction of the fold created is going backwards (may be it has to do with local coordinates of the Part vs global ccordinates of the document ?
while doing the bend from the part workshop (first plate crated from a cube), i dont experience the issue :
OS: Ubuntu 17.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13247 (Git)
Build type: None
Branch: master
Hash: 5022c8df5cef0690f2c8acff4bcebd82655a5f04
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: French/France (fr_FR)
Hi Shai,
I have stumbled on another odd behavior in the sheet metal workbench.
I created the attached model using FC 0.17.13005. (Remove .zip in the filename to open.)
The rear chassis and the bottom left cover parts unfold as expected.
The bottom right cover fails to unfold creating several shapes in the process. --This acts like the part was broken due to new faces being added by editing, so I will rebuild that part and not worry about it.
The reason I am writing is that, when I attempt to unfold either the top left cover or the top right cover nothing happens. The icon reacts and there is a brief pause but that's it.
I believe that the only difference between the way I built the bottom and top covers is that for the top covers I referenced the top edge of the rear chassis to create the XY working plane for the initial sketches.
Regards,
--Steve
Hi !
Freecad 0.17 (and 0.18) on Windows 7 64 Bit.
I use a spreadsheet where I specify the parameter of a metal chassis like width or high, which used to work fine with an old version of the sheet metal workbench but with an up to date version changing a parameter breaks the model.
Attached the freecad file (freecad sheetmetal error.zip) open it in Freecad with and uptodate version of the sheetmetal workbench installed, open the spreadsheet and change the parameter "High" from 120 to 200, freecad will recalculate the chassis and raises and error (see model tree on the left)
No install the old sheetmetal workbench (file: sheetmetal.ok.zip), restart freecad and do the same steps again and now everything works (hopefully) fine.
I have tested this issue on two PCs, always with the same result. The old workbench does the job the new one fails.
I hope this is clear otherwise let me know and I will try to give more information. The sheetmetal workbenach is a great tool and I really do not want to miss it.
Thank you. Dirk
freecad sheetmetal error.zip
sheetmetal ok.zip
sheetmetal broken.zip
https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalCmd.py#L650-L651
Saw it in this thread
specifically in this image:
It would be useful to have defaults pre-checked
i.e. 'manual k-factor' checked and 'ANSI' or 'DIN' selected
This would be best if it could be saved as in line 2148 as parameters
https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalUnfolder.py#L2148
would love to see an example of this WBs capabilities quickly. Please add something like this. Thanks!
how to reproduce:
It can be however FreeCAD engine limitation - but I am not a python enthusiast
During the unfold procedure the length block should be dependent from the K-factor. However I do not find the way how to change it. Such setup parameter will be extremely useful.
Every folded part, unfold gives "invalid thickness" error, worked yesterday.
It turns out the UnfoldOptions.ui
is not interpreted directly. AFAIU pyuic4
is used to generate Python codes located in SheetMetalUnfolder.py/SMUnfoldTaskPanel
. However, there are lots of code seems to be diverged from the output of UnfoldOptions.ui
.
What is the correct way to edit the UI?
Hey Shai,
In the attached example, I put in a 0.07 inch gap at one side of the "Cover top right middle bend." When I did so a 0.07 inch wide face was also incorrectly added to the front left edge of the part next to the middle bend. Thereafter, when I add the "Cover top right front bend" the 0.07 inch face is not included in the bend, thus resulting in an unintended gap at the front left corner.
The effect is repeatable with a new part. by creating one sketch, one pad and one bend with gap.
When unfold is performed with Generate projection sketch
disabled, following exception is thrown:
Traceback (most recent call last):
File "/home/aea/.FreeCAD/Mod/sheetmetal/SheetMetalUnfolder.py", line 2253, in accept
docG.getObject(sk.Name).LineColor = (0.0,0.0,0.5)
<type 'exceptions.UnboundLocalError'>: local variable 'sk' referenced before assignment
Unfolded solid is still generated successfully.
Hi @shaise
it would be possible to have the main WB icon as svg?
(D:\shai\FreeCAD\mkwall_xpm)
In HDPI monitors the actual XPM is little if used inside Selector Tool...
Thx
Maurice
PS if you could share the svg file, I could make a PR to switch from xpm to svg ๐
Currently when we unfold a part, generated objects gets the name as Unfold[nnn]
and Unfold_Sketch[nnn]
. It will be convenient to generate their names based on their source objects' label, such as ${src}[nnn]
.
When there are lots of objects to unfold and we need to erase all of them an re-generate, it gets a burden to rename every single unfold one by one.
Need to breakout length into length1 and length2 to independently adjust each side of bends and extends in order to create quadrilaterals.
Need to add Trim feature in order to create quadrilaterals.
When unfolding is finished, I get an error that o.SubObjects[0] is out of range.
I didn't check the reason, but in PerformUnfold() function you have:
if len(o.SubObjects)>1:
mw=FreeCADGui.getMainWindow()
QtGui.QMessageBox.information(mw,"SubelementError","""Only one flat face has to be selected!""")
else:
subelement = o.SubObjects[0]
changing else:
line to elif len(o.SubObjects)>0:
solves this issue.
Hi Shai,
If I make a bend and then make a second bend, in the Tree View the second bend will be shown in bold and the previous bend will be shown with a gray highlight. The information shown in the Property View reflects the information from the first bend.
Is this intended behavior?
I ask because I frequently screw up my model by creating a new bend and immediately adjusting the bend properties --only to find that I have inadvertently modified the properties of the previous bend, not the bend I just created.
I think it would improve bend work flow if, as the last step in a bend operation, you set the focus to the new bend rather than leaving it on the previous bend.
Thanks,
--Steve
I have a relatively simple model that fails unfolding. I'm attaching the model and the error log
Just remove the .zip extension from the project file.
See Issue
https://forum.freecadweb.org/viewtopic.php?f=22&t=25281&start=150#p279502
please change from
unfoldLength = ( bendR + kfactor * thk / 2.0 ) * bendA * math.pi / 180
to
unfoldLength = ( bendR + kfactor * thk / 2.0 ) * bendA * math.pi / 180.0
Add decimal place to 180.
@ line 1327
https://github.com/shaise/FreeCAD_SheetMetal/blob/master/SheetMetalUnfolder.py#L1327
there is a print without Round Brackets.
It is useful to check always the WB in Py3, Qt5 environment.
Bend angle has wrong value. In logs for my two faces I saw:
Face61 Type: Bend bend_dir: up
Face_idx 60 bend_angle -180.0
Face61 k-factor: 0.65
angle: -180.0 test_angle: 45.0 trans: 4.16261026601
(...)
Face17 Type: Bend bend_dir: up
Face_idx 16 bend_angle -180.0
Face17 k-factor: 0.65
angle: -180.0 test_angle: 45.0 trans: 4.16261026601
In this case unfolding has been done wrongly.
But when I saved the file, closed FreeCAD, and then reopened it, I got proper bend angle value:
Face61 Type: Bend bend_dir: up
Face_idx 60 bend_angle -180.0
Face61 k-factor: 0.65
angle: -180.0 test_angle: 45.0 trans: 4.16261026601
(...)
Face17 Type: Bend bend_dir: up
Face_idx 16 bend_angle 180.0
Face17 k-factor: 0.65
angle: 180.0 test_angle: 45.0 trans: 4.16261026601
Second angle is non-negative, and unfolding started working properly.
I suppose that it is a problem with rounding or different precision somewhere... Rather hard to determine what is the reason.
Hi!
First of all, thank you for your great work on the sheetmetal workbench. I worked a lot with it in the past and it usually worked great.
I use FreeCAD 0.18 stable with Debian on my computer at work.
Recently I noticed, that the gaps at sheet metal bends appear twice as big as i intended and I can reproduce it. To verify if the failure is not in my config, I renamed my .FreeCAD folder, to get a new FreeCAD without my old config files and installed a new sheetmetal workbench over the addon manager. Then I made a simple new model to verify if the bug still appears. And it did. My coworker has the same issue with the sheetmetal workbench on his FreeCAD. So I think that might be a bug.
Please find a sample file and a screenshot attached.
In this sample I intended a 5mm gap but I get 10mm.
I would be glad, if you could have a look on it to verify if its an actually bug.
Best regards,
Ludwig
This sheetmetal workbench is very nice to me. It enables users to create sheetmetals, which is commonly used in industry production.
But currently there is only one way to create sheetmetal geomety in this workbench: to add sheetmetal geomety at an existing edge. In some circumstances, it is not convevient. Product below is an example.
I'd like to propose to implement one more function: to convert solid body to sheetmetal. This is not anything new. We can see this function in any main stream software like SolidWorks. Please kindly consider it. Thanks a lot.
Hardware:
Intel Core i5-2500K Sandy Bridge
Intel HD Graphics 3000
Software:
OS: Linux Mint 17.2 Rafaela
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6700 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: 7b925d11aa69ac405b423635adb1e2833f18a817
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
SheetMetal Workbench V0.0.13
To reproduce the problem:
Description of problem:
One of the faces that should meet the right angle has one corner misplaced. It looks to me like a sign problem - something is being added to a coordinate when it should be subtracted.
This bug only happens when:
Hey Shai,
I just updated to your latest sheetmetal workbench and decided to try out mitered bends.
Pretty cool!
I did run into a problem, though. If I make one mitered bend the part unfolds exactly as expected. If I make a second bend from the face of the mitered bend then the part won't unfold. Instead I get one of two error messages, depending on which face I select to initiate the unfold.
Regards,
--Steve
Unfolding fails with error:
Error Analysis: counter face not found at Face37
It occurs with current plugin version with freecad 0.16.
It seems to be related to the rectangle on Sketch002. When I remove it or use some particular dimensions, it works fine.
Here is the file and log from console:
unfold_log.txt
emi-prototyp7-ramka-ekran_10_1.zip
If you need, I can test some modifications, provide some additional debug info etc.
If a bent part is closed on itself, start point of unfolded part is determined erroneously.
Here is a closed bent part:
Here is the erroneous unfold:
Breaking the loop with a negligible distance fixes the issue:
Here is the correct unfold:
Created with LinkStage3@e9c60d4d
: simple.fcstd.remove-me.zip
Hey Shai,
I simplified the Issue 9 example part down to one L-shaped part with two bends and discovered a (perhaps related) problem. The two bends are both associated with the inner corner of the L. One bend has a gap to keep the two bends from interfering with one another when unbent.
The part is drawn correctly after both bends. However, it is not possible to unbend the part starting from the bend face that abuts the inner corner. You can unbend the part if you start from the other bend face (the one with the gap). In that case the part unbends but the abutted bend breaks during the unfold.
It may be that you have to add a cut at the inner corner of the L to isolate the face edge before you initiate the bend.
Regards,
--Steve
Hi,
is there a chance this tool gets updated for version 0.17?
Since I cant realy create sketches on faces created with this tool anymore in 0.17, but need this version for compatibility with another tool(dimensioning).
greetings Tarcontar
It is useful in some cases and it seems to be not a problem to allow it.
I'm not creating a pull request because I'm not sure if it doesn't have any side effects. Here is the patch:
diff --git a/SheetMetalCmd.py b/SheetMetalCmd.py
index ce89972..1671799 100644
--- a/SheetMetalCmd.py
+++ b/SheetMetalCmd.py
@@ -40,7 +40,7 @@ def smMakeFace(edge, dir, from_p, to_p):
return Part.Face(w)
-def smBend(bendR = 1.0, bendA = 90.0, flipped = False, extLen = 10.0, gap1 = 0.0, gap2 = 0, reliefW = 0.5,
+def smBend(bendR = 1.0, bendA = 90.0, flipped = False, extLen = 10.0, gap1 = 0.0, gap2 = 0.0, reliefW = 0.5,
reliefD = 1.0, selFaceNames = '', MainObject = None):
#AAD = FreeCAD.ActiveDocument
@@ -256,14 +256,14 @@ class SMExtrudeWall:
selobj = Gui.Selection.getSelectionEx()[0]
obj.addProperty("App::PropertyLength","length","Parameters","Length of wall").length = 10.0
- obj.addProperty("App::PropertyLength","gap1","Parameters","Gap from left side").gap1 = 0.0
- obj.addProperty("App::PropertyLength","gap2","Parameters","Gap from right side").gap2 = 0.0
+ obj.addProperty("App::PropertyFloat","gap1","Parameters","Gap from left side").gap1 = 0.0
+ obj.addProperty("App::PropertyFloat","gap2","Parameters","Gap from right side").gap2 = 0.0
obj.addProperty("App::PropertyLinkSub", "baseObject", "Parameters", "Base object").baseObject = (selobj.Object, selobj.SubElementNames)
obj.Proxy = self
def execute(self, fp):
#s = smExtrude(extLength = fp.length.Value, selFaceNames = self.selFaceNames, selObjectName = self.selObjectName)
- s = smBend(bendA = 0.0, extLen = fp.length.Value, gap1 = fp.gap1.Value, gap2 = fp.gap2.Value, reliefW = 0.0,
+ s = smBend(bendA = 0.0, extLen = fp.length.Value, gap1 = fp.gap1, gap2 = fp.gap2, reliefW = 0.0,
selFaceNames = fp.baseObject[1], MainObject = fp.baseObject[0])
fp.Shape = s
following this thread
https://forum.freecadweb.org/viewtopic.php?f=3&t=27928&hilit=sheet+metal&start=10#p229286
it seems that in some case Unfolding routines are generating a shape with BSplines...
But with the solution suggested by @UR_ it seems to be fine.
Could his solution be merged?
Thx
Maurice
I was trying to unfold this part, but got this error when trying to unfold from the small flat face at the top of the part: "Error Analysis: did not find startangle of bend, please post failing sample for analysis at Face36"
Here are the part and log files from doing this unfold.
B5.cleaned.STEP.zip
postable-log.txt
Note: I have this set of changes in my plugin code to allow me to get the actual error response rather than just a crash.
Internet searches as well as Wikipedia page shows that the definition of "k-factor" is as follows:
K-factor is a ratio of location of the neutral line to the material thickness as defined by t/T where t = location of the neutral line and T = material thickness. (...) and usually between 0.3 and 0.5.
Based on this information, latest change of k-factor in SheetMetal is misleading, thus should be reverted.
Moreover, the formula newNode.k_Factor = (0.65 + 0.5*math.log10(innerRadius/self.__thickness))
has no explanation. It should be explained or removed. There is a long discussion about this formula in SW forum and seems that it's still unclear: https://forum.solidworks.com/thread/38306
to facilitate better searching for users, if you don't mind please add: 'freecad' 'addon' and any other tags you deem relevant? Thanks!
Need to breakout radius into radius1 and radius2 to independently adjust each end of radius in order to create cones.
Currently, unfolding the following part:
produces following output in DXF file (via TechDraw workbench):
I added the red line with Gimp, which is what I wanted instead of the green ones (because I'm bending the sheet metal with air bending technique).
How can I produce one bending line (the red one) instead of these two green ones?
Click on "Sheet Metal Unfolder" says Unable to fetch the code of this macro
Install/Update gives: Unable to install
Hi,
I really appreciate your WB. I think you made a great job. In any case, would it possible in the future to consider that when deleting a bend the model doesn't show errors and recompute properly?
I mean, if you create bend & bend001, if you delete bend bend001 gives error and you can't edit.
Is it because it has to rename faces?
I tried the same on partDesign and if a feature is not related to another, the model recompute properly.
Thanks.
Cheers.
I'd like to write a macro to unfold a geometry programmatically, in order to make an attempt to resolve #40 . Where can I find the Python API?
It would be useful to re-attribute a bend or extend feature to a different face ID after its creation. Due to FreeCAD's topological naming issue, if changes are made to a bend's properties (like gap1 and gap2) that changes the number of faces it generates, then following operations will likely fail or produce unexpected results after a recompute. An editing option would allow the end user to repair failed features.
This is a recent example where editing bends would be useful: FreeCAD forum - Sheet Metal bending
Thanks.
Hi,
OS: Ubuntu 16.04.6 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13541 (Git)
Build type: None
Branch: releases/FreeCAD-0-17
Hash: 9948ee4f1570df9216862a79705afb367b2c6ffb
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
SheetMetal v 0.2.30
I tested the new feature - Fold-on-sketch-line, and I found quite strange behaviour then folding angle is > 99 degrees.
Example.fcstd.zip
Hi @shaise @ulrich1a
following this thread
https://forum.freecadweb.org/viewtopic.php?f=3&t=28331#p229621
it seems the SheetMetal WB should generate a sketch of middle of the bend.
It would be very useful to have also a similar option implemented.
Thanks for any insight.
Please find attached a simple FC file with the two sketches compared (one from the unfolded and one from the suggested middle references)
unfolding-FCStd.zip
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.