Cannot change multiple joint origin properties

Cannot change multiple joint origin properties

Skullivan
Participant Participant
465 Views
3 Replies
Message 1 of 4

Cannot change multiple joint origin properties

Skullivan
Participant
Participant

I'm having a weird problem where I have created a joint origin and immediately after I am trying to set isFlipped to True and give it an x-axis entity. The problem is that it will only change the first parameter in the code.

 

For example: 

This code will only make the joint origin flipped and will not give it an xAxisEntity.

 

        pringle_factory_origin.timelineObject.rollTo(True)
        pringle_factory_origin.xAxisEntity = axis_selection
        pringle_factory_origin.isFlipped = True
        design.timeline.moveToEnd()

 

 

This code will only give the joint origin an xAxisEntity but will not be flipped.

 

        pringle_factory_origin.timelineObject.rollTo(True)
        pringle_factory_origin.isFlipped = True
        pringle_factory_origin.xAxisEntity = axis_selection
        design.timeline.moveToEnd()

 

 

I also tried using the rollTo() method before each parameter change and still it only changes the first parameter in the program. It seems to be resetting the first parameter that I try to change when the second parameter gets set.

Anyone have any ideas? Am I missing something obvious here?

0 Likes
466 Views
3 Replies
Replies (3)
Message 2 of 4

kandennti
Mentor
Mentor

Hi @Skullivan .

 

I tried it.

I was able to confirm that the first process is indeed cleared.
Probably a bug.

 

 

1.png

The attached data is on the left side, and the API of Ver2.0.14110 does not allow me to change it to the right side.

 

I forced myself to create a sample to be processed by text command.

# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core


def run(context):
    ui = adsk.core.UserInterface.cast(None)
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface
        design: adsk.fusion.Design = app.activeProduct
        root: adsk.fusion.Component = design.rootComponent

        pringle_factory_origin: adsk.fusion.JointOrigin = root.jointOrgins[0]


        sels: adsk.core.Selections = app.userInterface.activeSelections
        sels.clear()

        sels.add(pringle_factory_origin)
        app.executeTextCommand(u'Commands.Start EditJointOriginR2Cmd')

        app.executeTextCommand(u'Commands.SetBool Flip11 1')
        app.executeTextCommand(u'Commands.SetBool Reorient11 1')
        app.executeTextCommand(u'UI.EnableCommandInput XAxis11')
        sels.clear()
        sels.add(root.yConstructionAxis)
        app.executeTextCommand(u'NuCommands.CommitCmd')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

However, since it is necessary to separate the processing while checking the status, it will not be very useful.

Message 3 of 4

Skullivan
Participant
Participant

So you're saying that I can process just one of the commands I'm losing as a text command and that should work as a workaround for now?

 

I did run your code and saw that it works this way. I just don't know enough to understand if this will work in line with the api methods I was trying to use.

 

It definitely would be good to see this bug fixed however.

0 Likes
Message 4 of 4

BrianEkins
Mentor
Mentor

I can reproduce the problem you're seeing. I'll work with Autodesk to make sure a bug is filed and hopefully, it can be addressed soon.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com