FreeCAD_SheetMetal
FreeCAD_SheetMetal copied to clipboard
Basename of the Unfolded objects
Hi @shaise , I would like to suggest to use the base Body name (actually Label) as the basename of the unfolded objects.
For instance, the object name is Bottom
Then if I unfold it, it could generate the Bottom_Unfolded and the Bottom_Unfolded_Sketch
Sounds like a good idea. Added to my to do list
Nice, thanks. I tried to improve this here https://github.com/shaise/FreeCAD_SheetMetal/pull/352. What do you think?
The proposal works as you can see in the screenshot below.
I just noticed an interesting thing.
I have enabled the Freecad option to allow object with the same Label.
So no more 001, 002, 003.. at the end of repeated objects.
However when I repeat the unfolding of the same object.
It creates this new Part ending with 001 and a new Sketch with the right name as in my configs. I am not sure if this is an issue with the Sheetmetal or if this is an issue with my latest 0.22-dev build.
What do you think?
Ah nevermind, this looks like a bug on the latest dev.
of object names are not unique anymore how can you tell them apart?
hm did not know, I got the first parent from the Parents list and on my test, it worked. maybe I got lucky.
Actually all partents are the same, maybe...
This example here:
Gui.Selection.addSelection('Unnamed','Body001','Bend001.')
>>> ### Begin command Std_SendToPythonConsole
>>> # try:
>>> # del(doc,lnk,obj,shp,sub,subs)
>>> # except Exception:
>>> # pass
>>> #
>>> # doc = App.getDocument("Unnamed")
>>> # obj = doc.getObject("Bend001")
>>> # shp = obj.Shape
>>> ### End command Std_SendToPythonConsole
>>> obj.Label
'Bend001'
>>> obj.Parents
[(<body object>, 'Bend001.'), (<body object>, 'Bend001.')]
>>> obj.Parents[0][1]
'Bend001.'
>>> obj.Parents[0][0].Name
'Body001'
>>> obj.Parents[0][0].Label # <======== Label of the First parent
'my_Body'
>>> obj.Parents[1][0].Label # <======== Label of the Second parent
'my_Body'
>>>
```python
I dont think it has to do with object parents. It should be done based on the selected object before the fold.
it can happen too.
the feature is inside a body, the selected body is the same.
can I select multiple bodies to unfold at the same time?
no
If I select a face to unfold, then there is no selected body.
What is selected is a face. Which has a parent body, which is the my_Body in this case
The way I implemented works fine.