How can I rotate this key board?

How can I rotate this key board?

Anonymous
Not applicable
1,315 Views
6 Replies
Message 1 of 7

How can I rotate this key board?

Anonymous
Not applicable

Hi, I want to rotate this mac book cad model and I succeeded in rotating laptop except keyboard, because I can't get occurrence of the keyboard. How can I get occurrence of the keyboard and rotate it?

Screen Shot 2019-02-26 at 13.04.39.pngScreen Shot 2019-02-26 at 13.03.39.png 

0 Likes
Accepted solutions (1)
1,316 Views
6 Replies
Replies (6)
Message 2 of 7

goyals
Autodesk
Autodesk

I do not see if there is any different way required for keyboard as well. May be you would like to check if initial transform you are getting from occurrence is correct for keyboard or not.



Shyam Goyal
Sr. Software Dev. Manager
0 Likes
Message 3 of 7

Anonymous
Not applicable

I checked count of occurrences list and it's 2. Occurrences.asList.item(2) are None. So definitely I can't get keyboard's occurrence. Please check my code and picture

0 Likes
Message 4 of 7

p.seem
Advocate
Advocate

The component.occurrences method only returns the top-level occurrences in the component, so it could be that your keyboard is just a body, or it could be a sub-component of something else.  It's very difficult to say why the keyboard isn't part of the list of occurrences from just the screenshot.  Would you be willing to share a copy of the model? Or, failing that, a screen shot that shows the design tree, fully expanded?

Message 5 of 7

Anonymous
Not applicable

I see. I attached the mac book cad file.

0 Likes
Message 6 of 7

p.seem
Advocate
Advocate
Accepted solution

Yes, it looks like that was what was going on.  The body and lid are each their own component, but each of the keys is just a body within the root component. 

 

Components and bodies are quite different in the Fusion architecture, and 'Occurrences' are instances of a component.  You'd need to use a different method to iterate through all of the bodies, but then the body and lid wouldn't be included in that list.  I would recommend you create a new component and move all of the key bodies into it (see attached file).  Then I think you'll find the keyboard is also included in the rootComponent.occurrences list.

 

Folks in the design forum generally recommend one body per component, so you might even go further and turn each key into a component, and make them all sub-component of the keyboard.  But that step isn't necessary to make your script work.

 

I hope that helps.

Message 7 of 7

Anonymous
Not applicable

It does work. I really appreciate you.

0 Likes