"RuntimeError: 5 : A joint in system exsists for the provided input."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
What it should be producing instead:
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