Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basename of the Unfolded objects #350

Open
leoheck opened this issue Jun 27, 2024 · 14 comments
Open

Basename of the Unfolded objects #350

leoheck opened this issue Jun 27, 2024 · 14 comments
Labels

Comments

@leoheck
Copy link

leoheck commented Jun 27, 2024

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

image

@shaise shaise added the feature label Jun 27, 2024
@shaise
Copy link
Owner

shaise commented Jun 27, 2024

Sounds like a good idea.
Added to my to do list

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

Nice, thanks. I tried to improve this here #352. What do you think?

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

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?

image

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

Ah nevermind, this looks like a bug on the latest dev.

@shaise
Copy link
Owner

shaise commented Jun 27, 2024

of object names are not unique anymore how can you tell them apart?

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

hm did not know, I got the first parent from the Parents list and on my test, it worked. maybe I got lucky.

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

Actually all partents are the same, maybe...

This example here:
image

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

@shaise
Copy link
Owner

shaise commented Jun 27, 2024

I dont think it has to do with object parents. It should be done based on the selected object before the fold.

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

it can happen too.

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

the feature is inside a body, the selected body is the same.

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

can I select multiple bodies to unfold at the same time?

@shaise
Copy link
Owner

shaise commented Jun 27, 2024

no

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

If I select a face to unfold, then there is no selected body.
image

What is selected is a face. Which has a parent body, which is the my_Body in this case

@leoheck
Copy link
Author

leoheck commented Jun 27, 2024

The way I implemented works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants