"RuntimeError: 5 : A joint in system exsists for the provided input."

keith_j
Explorer

"RuntimeError: 5 : A joint in system exsists for the provided input."

keith_j
Explorer
Explorer

Hi all,

 

I'm trying to align a part to a fixture using the edges of hole features and revolute joints with the API. If I create the joints with the UI manually it works. I was also able to create similar functionality to what I'm trying to do here using JointGeometry.createByPlanarFace instead of JointGeometry.createByCurve with slightly different code/models.

 

There doesn't appear to be anything wrong with either joint as long as they don't get added at the same time or if one is suppressed when the other is created. If you unsuppress the first joint after the second is made, it's works well too. I'm fairly certain I'm selecting the correct edges in the script.

 

The full error is "RuntimeError: 5 : A joint in system exsists for the provided input. Sytem will be over constrined with this input." All 3 spelling errors and all.

 

This may be related to https://forums.autodesk.com/t5/fusion-360-api-and-scripts/insert-and-constrain-a-component-at-differ... but I couldn't recreate an error after fixing their typo so I'm not sure.

 

Thanks

 

After running the script:

error.png

 

What it should be producing instead:

correct.png

 

Script:

#Author-Keith J
#Description-Align part to fixture using hole features.

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        design = app.activeProduct
        rootComp = design.rootComponent
        ui  = app.userInterface
        joints = rootComp.joints
        
        ui.messageBox('Select Part')
        selectedPartOccurrence = ui.selectEntity("Select a component", "Occurrences")
        selectedPartOccurrenceValue = selectedPartOccurrence.entity
        selectedPartComponent = selectedPartOccurrenceValue.component
        
        ui.messageBox('Select Fixture')
        selectedFixtureOccurrence = ui.selectEntity("Select a component", "Occurrences")
        selectedFixtureOccurrenceValue = selectedFixtureOccurrence.entity
        selectedFixtureComponent = selectedFixtureOccurrenceValue.component
        

        #Get one edge of each hole feature
        partHoleFeature0 = selectedPartComponent.features.holeFeatures.itemByName('PartHole0')
        partHoleEdge0 = partHoleFeature0.sideFaces.item(0).edges.item(0)
        
        partHoleFeature1 = selectedPartComponent.features.holeFeatures.itemByName('PartHole1')
        partHoleEdge1 = partHoleFeature1.sideFaces.item(0).edges.item(0)


        fixtureHoleFeature0 = selectedFixtureComponent.features.holeFeatures.itemByName('FixtureHole0')
        fixtureHoleEdge0 = fixtureHoleFeature0.sideFaces.item(0).edges.item(1) 
        
        fixtureHoleFeature1 = selectedFixtureComponent.features.holeFeatures.itemByName('FixtureHole1')
        fixtureHoleEdge1 = fixtureHoleFeature1.sideFaces.item(0).edges.item(1)
        
        
        #Get proxies for each edge in the appropriate context
        partHoleEdge0Proxy = partHoleEdge0.createForAssemblyContext(selectedPartOccurrenceValue)
        partHoleEdge1Proxy = partHoleEdge1.createForAssemblyContext(selectedPartOccurrenceValue)

        fixtureHoleEdge0Proxy = fixtureHoleEdge0.createForAssemblyContext(selectedFixtureOccurrenceValue)
        fixtureHoleEdge1Proxy = fixtureHoleEdge1.createForAssemblyContext(selectedFixtureOccurrenceValue)
        
        
        #Create JointGeometry pairs
        geo0 = adsk.fusion.JointGeometry.createByCurve(partHoleEdge0Proxy, adsk.fusion.JointKeyPointTypes.CenterKeyPoint)
        geo1 = adsk.fusion.JointGeometry.createByCurve(fixtureHoleEdge0Proxy, adsk.fusion.JointKeyPointTypes.CenterKeyPoint)
        
        geo2 = adsk.fusion.JointGeometry.createByCurve(partHoleEdge1Proxy, adsk.fusion.JointKeyPointTypes.CenterKeyPoint)
        geo3 = adsk.fusion.JointGeometry.createByCurve(fixtureHoleEdge1Proxy, adsk.fusion.JointKeyPointTypes.CenterKeyPoint)
        
        
        #Create the joints
        jointInput = joints.createInput(geo0, geo1)
        jointInput.isFlipped = True
        jointInput.setAsRevoluteJointMotion(adsk.fusion.JointDirections.ZAxisJointDirection)
        
        jointInput2 = joints.createInput(geo2, geo3)
        jointInput2.isFlipped = True
        jointInput2.setAsRevoluteJointMotion(adsk.fusion.JointDirections.ZAxisJointDirection)
        
        
        #Add the joints.
        joints.add(jointInput)
        joints.add(jointInput2)
        
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

Files used:

Test Design: http://a360.co/2B1mEyG

Fixture: http://a360.co/2B4tseJ

Part: http://a360.co/2r93VkX

0 Likes
Reply
378 Views
2 Replies
Replies (2)

marshaltu
Autodesk
Autodesk

Hello,

 

It looked be API bug and UP-37919 has been logged to track it.

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes

Ilkka_T
Contributor
Contributor

Hello!

 

I am experiencing similar issue of adding 2 joints (planar and revolve) to a component occurence, to fully constrain it. I have joint origins on 3d sketch lines, which i want component occurences constrained to. It seems I can do it manually in the UI but not through the API no matter I have tried it in numerous ways. With API both joints create fine by themselves, but the second one always fails no matter what is the order of creation.

 

In the UI it warns me of joint already existing between the components, but after clicking ok, everything works as expected:

 
 

With C++ script I get the error below:

Ilkka_T_0-1586852728261.png

 

Could this still be the same bug UP-37250 after two years?

 

Best Regards,

Ilkka

0 Likes