Selecting different faces the unfold projection is always in XY plane. Is this on purpose? Converting to sketch worked in all cases (which I tried).
help on sheet metal script
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: help on sheet metal script
- Attachments
-
- Bildschirmfoto 2018-06-23 um 23.09.20.png (20.31 KiB) Viewed 1750 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: help on sheet metal script
Here is my file, where it failed (attached)
I have selected the outside left wall of bend005, unfold and try to draft convert to sketch.
I have selected the outside left wall of bend005, unfold and try to draft convert to sketch.
- Attachments
-
- TestSheetmetalProject.FCStd
- (13.71 KiB) Downloaded 47 times
Re: help on sheet metal script
Hi @shai,
please have a try with the attached file.
I have added the code to create a sketch from the projection (and I set the transparency of the Undold to 70%). Feel free to adapt or modify as you prefer.
Thanks again for your WB. it is very useful!
PS I tested fine with some old user cases:
https://forum.freecadweb.org/viewtopic. ... 10#p229329
https://forum.freecadweb.org/viewtopic. ... 40#p225073
https://forum.freecadweb.org/viewtopic. ... 20#p200544
Re: help on sheet metal script
Hi @shai,
I noticed your post after posting my code...
I managed to change my code to work with your example too. here it is.
Please have a try.
Re: help on sheet metal script
Hi easyw,
No, it still have the same issue. Load the attached file, click on the left wall (the green face in the image) and perform unfold. The same error. (happens only on certain faces) shai
No, it still have the same issue. Load the attached file, click on the left wall (the green face in the image) and perform unfold. The same error. (happens only on certain faces) shai
- Attachments
-
- TestSheetmetalProject1.FCStd
- (7.79 KiB) Downloaded 45 times
Re: help on sheet metal script
This issue could happens also when doing the conversion through the Draft Menu 'Draft to Sketch'
Code: Select all
('[Draft.todo.commit] Unexpected error:', <class 'Base.FreeCADError'>, 'in ', <built-in method closeDialog of tuple object at 0x000001EEBAC047C8>, '(', None, ')')
We could fill a bug with a simple example.
Anyway, the actual code is adding already a very useful feature
Re: help on sheet metal script
Indeed This is helpful. At first I thought it will be quite complex to add the fold lines (as the unfold code is not mine, and I'm not as talented as Ulrich1a...) But it turned out to be ok.
I will now wrap up things (I want to add a task dialog, so the user can select weather to generate the sketch or not) and commit it to the main code.
Thanks for all the help with the sample code.
shai
Re: help on sheet metal script
Thanks a lot!
I was trying to create a Sketch using the edges and creating the geometry, but I cannot generate correctly open Arcs...
Here my tentative:
Code: Select all
import FreeCAD, Draft, Sketcher
doc = App.ActiveDocument
edges = doc.UnfoldProjection.Shape.Edges
# doc.Shape2DView_sc.Shape.Edges #App.ActiveDocument.UnfoldProjection.Shape.Edges
usk = FreeCAD.activeDocument().addObject('Sketcher::SketchObject',"Unfold_Sketch")
for e in edges:
print e.Curve
geo=[]
for e in edges:
if 'Line' in str(e.Curve):
geo.append(Part.LineSegment(e.Vertexes[0].Point,e.Vertexes[1].Point))
elif 'Circle' in str(e.Curve):
Radius = e.Curve.Radius
Center = e.Curve.Center
Axis = e.Curve.Axis
StartAngle = e.Curve.FirstParameter
EndAngle = e.Curve.LastParameter
geo.append(Part.ArcOfCircle( Part.Circle(Center,Axis,Radius),StartAngle,EndAngle , False))
#print geo
usk.addGeometry(geo)
doc.recompute()
Re: help on sheet metal script
Hi Shai,
I've solved the issue of Arcs...
Here the code that will generate Sketches in all cases... What are not considered are BSplines.. but they shouldn't be in the generated UnfoldProjection, if I recall correctly... Please have a try