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: 

Change the flip parameter

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
l.diana9
256 Views, 3 Replies

Change the flip parameter

Hello!

jnt :adsk.fusion.Joint = components.itemByName('MUVPAssemby').joints.itemByName('Rigid2')
offset :adsk.fusion.ModelParameter = jnt.offset

offset.expression = str(-int(hSp[:-3]))
app.activeViewport.refresh()

Here's a part of my code I have changed the parameter of offset. And I wanted to ask you If you know hot to change the Flip parameter just the same way?

Labels (2)
3 REPLIES 3
Message 2 of 4
BrianEkins
in reply to: l.diana9

The Joint object supports the isFlipped property.  It's a read-write property so you can get and set the flipped state.  The line below can be added to yours to flip the direction.

 

jnt.isFlipped = not jnt.isFlipped
---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 4
kandennti
in reply to: BrianEkins

@BrianEkins .

When I tried using Fusion360 Ver. 2.0.10253, it gave me errors in all cases.

    jnt.isFlipped = not jnt.isFlipped
    jnt.isFlipped = True
    jnt.isFlipped = False

 

@l.diana9 .
You should be able to get to your goal faster if you ask your question in the forum rather than in a private message.

Message 4 of 4
BrianEkins
in reply to: kandennti

Most edits to a joint require the timeline to be rolled to before the joint.  Here's a snippet that demonstrates the workflow by flipping a selected joint.

# Get a joint by having the user select one.
joint: adsk.fusion.Joint = ui.selectEntity('Select a joint.', 'Joints').entity

# Get the current position of the marker in the timeline.
tlPstn = des.timeline.markerPosition

# Reposition the marker to before the joint.
joint.timelineObject.rollTo(True)

# Change the isFlipped property.
joint.isFlipped = not joint.isFlipped

# Reposition the timeline marker to the original position.
des.timeline.markerPosition = tlPstn
---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com

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