Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

First joint missing in joints list?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
kent.vandervelden
392 Views, 6 Replies

First joint missing in joints list?

Hi, I'm accessing a number of joints, but one is missing from the component's joint list. Perhaps someone will see what I'm doing wrong. Thank you

 

Using the Python Fusion 360 API, I've managed to find the joint list for the component in my assembly, and can enumerate the joint names, but one joint is missing, Rev6.

 

(Pdb) root = design.rootComponent
(Pdb) comp1 = root.occurrences.itemByName('_0006_SA02_Default:1').childOccurrences.itemByName('0006_001_MC01-5_Default:1').component
(Pdb) comp1.name
0006_001_MC01-5_Default (Pdb) [x.name for x in comp1.joints] ['Rev7', 'Rev10', 'Cyl15'] (Pdb)

 

Using ui.selectEntity(...), I can select Rev6, verify its name, verify that I have the same parent as with the previous code, and verify that the parent's joints list is missing Rev6.  

 

(Pdb) j1 = ui.selectEntity('Select joint', 'Joints').entity
(Pdb) j1.name
Rev6
(Pdb) j1.parentComponent.name
0006_001_MC01-5_Default
(Pdb) [x.name for x in j1.parentComponent.joints]
['Rev7', 'Rev10', 'Cyl15']

 

 Selecting a different joint associated with the parent shows the same result.

 

 

(Pdb) j1 = ui.selectEntity('Select joint', 'Joints').entity
(Pdb) j1.name
Rev7
(Pdb) j1.parentComponent.name
0006_001_MC01-5_Default (Pdb) [x.name for x in j1.parentComponent.joints] ['Rev7', 'Rev10', 'Cyl15']

2017-06-05 07_08_04-Clipboard.png

 

 

6 REPLIES 6
Message 2 of 7
ekinsb
in reply to: kent.vandervelden

Would it be possible to post the assembly here or you can also send it directly to me at brian dot ekins at autodesk dot com.  The behavior does seem strange.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 7
kent.vandervelden
in reply to: ekinsb

Of course. I'm not sure how to post the assembly here, but perhaps this sharing link will work instead? http://a360.co/2rECJqM

And the complete script can be found at http://bit.ly/2qZ90ag

Thank you, Kent

Message 4 of 7
ekinsb
in reply to: kent.vandervelden

I'm able to reproduce the problem using your assembly and have filed a bug. We should be able to look into it soon.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 5 of 7
kent.vandervelden
in reply to: ekinsb

Great, thank you! BTW: I really enjoy your blog

Message 6 of 7
ekinsb
in reply to: kent.vandervelden

I have some good news.  There aren't any problems with the API in this area.  It was a user error for both you and me.  The issue is that there are different kinds of joints.  There is the standard Joint object, the AsBuiltJoint object, and the RigidGroup object.  When you first reported the problem my first thought was that it was an as-built joint but I looked at the joint that was causing the problem in the UI and it appeared to be a standard joint to me.  The UI doesn't do a very good job of differentiating between the two. It refers to both as just "Joints" but when you edit an as-built joint there are less options in the edit dialog.

 

Anyway, in your case the joint that wasn't being returned is actually an as-built joint and most of the joints in your assembly are as-built joints.  To get to them you need to use the AsBuiltJoints collection object instead of the Joints collection.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 7 of 7
kent.vandervelden
in reply to: ekinsb

Wonderful, thank you for finding the solution. I admit, I did notice the various *joint members, but once I found one that seemed to make sense, I stopped investigating. Your note encouraged more investigation, and the members allAsBuiltJoints, allJoints, asBuiltJoints, and joints all appear interesting. With all*Joints if appears I can avoid the traversing the assembly. Allowing one to select the joints through the UI will be better, but small steps while learning, and the coding overhead of UI code is heavy for an example like mine.

 

(Pdb) [x.name for x in part1.component.asBuiltJoints]
['Rev6']

  

(Pdb) [x.name for x in part1.component.joints]
['Rev7', 'Rev10', 'Cyl15']

And after replacing the as built joint with a normal one, all the joints appear in the same list.

 

(Pdb) [x.name for x in part1.component.joints]
['Rev7', 'Rev10', 'Cyl15', 'Rev6']

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report