Change the flip parameter

Change the flip parameter

Anonymous
Not applicable
921 Views
3 Replies
Message 1 of 4

Change the flip parameter

Anonymous
Not applicable

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?

0 Likes
Accepted solutions (1)
922 Views
3 Replies
Replies (3)
Message 2 of 4

BrianEkins
Mentor
Mentor

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
0 Likes
Message 3 of 4

kandennti
Mentor
Mentor

@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

 

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

0 Likes
Message 4 of 4

BrianEkins
Mentor
Mentor
Accepted solution

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