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: 

Extend Feature: RuntimeError: 5 : Some input argument is invalid.

3 REPLIES 3
Reply
Message 1 of 4
BradAndersonJr
129 Views, 3 Replies

Extend Feature: RuntimeError: 5 : Some input argument is invalid.

Hey!

I created a Python add-in several years ago called `Guitar Engine`.  I haven't made many changes to it in over 3 years.  As of a few updates ago the script no longer properly functions and I can't figure out it.

I receive this error now:

 

Failed:
Traceback (most recent call last):
  File "C:/Users/brad/AppData/Roaming/Autodesk/Autodesk Fusion 360/API/AddIns/Guitar Engine [Beta]/Guitar Engine [Beta].py", line 1512, in buildFretboard
    extendFeature1 = extendFeatures.add(extendFeatureInput1)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/brad/AppData/Local/Autodesk/webdeploy/production/fd081b4c15f2fc37998034adb20de16163fc298f/Api/Python/packages\adsk\fusion.py", line 20197, in add
    return _fusion.ExtendFeatures_add(self, input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: 5 : Some input argument is invalid.

 


Here's the tidbit of code this is referencing:

 

# Get the body created by the stitch
        face = stitch.bodies.item(0)
        if createFilletRadius.value:
            topFace = face.faces.item(6)
        else:
            topFace = face.faces.item(4)
        # Create input entities for offset feature
        inputEntities = adsk.core.ObjectCollection.create()
        inputEntities.add(topFace)
        # Create an input for offset feature
        offsetFeature = fretboardComp.features.offsetFeatures
        offsetInput = offsetFeature.createInput(inputEntities, adsk.core.ValueInput.createByReal(-tangDepth),
                                                 adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
        #Get the surface body.
        extrudeFeature = offsetFeature.add(offsetInput)
        extrudeFeature.name = 'Offset: Fret Projections'
        offSurf = extrudeFeature.bodies.item(0)
        offSurf.name = 'Reference for fret cuts'
        offSurf.isVisible = False
        #Get an edge from surface, and add it to object collection.
        extend = offSurf.edges
        ext1 = extend.item(0)
        ext2 = extend.item(1)
        ext3 = extend.item(2)
        ext4 = extend.item(3)
        inputEdges = adsk.core.ObjectCollection.create()
        inputEdges.add(ext1)
        inputEdges.add(ext2)
        inputEdges.add(ext3)
        inputEdges.add(ext4)
        #Define a distance to extend.
        distance = adsk.core.ValueInput.createByString('0.5 in')
        #Create an extend input to be able to define the input needed for an extend.
        extendFeatures = fretboardComp.features.extendFeatures
        extendFeatureInput1 = extendFeatures.createInput(inputEdges, distance, adsk.fusion.SurfaceExtendTypes.NaturalSurfaceExtendType)
        #Create an extend feature.
        extendFeature1 = extendFeatures.add(extendFeatureInput1)
        extendFeature1.name = 'Extend: Fret Projections'

 

 

Line 37 is Line 1512 in my script. `extendFeature1 = extendFeatures.add(extendFeatureInput1)`

 

I've tried to trace backward to see why all of a sudden this creates the error but I can't figure it out.  

The code in its entirety is here >> https://github.com/bradandersonjr/GuitarEngine/blob/master/Guitar%20Engine%20%5BBeta%5D.py

I know it's not pretty and needs to eventually be overhauled.

I appreciate any guidance or help offered!

Thank you!

 

 

 

 

Brad Anderson Jr
Fusion 360 Hobbyist
Fusion 360 Luthiers Facebook Group
3 REPLIES 3
Message 2 of 4
BrianEkins
in reply to: BradAndersonJr

I'm able to reproduce the problem. I'm sure nothing has changed in the API, and I suspect something has changed in the Extend Feature command. When I test the command, I cannot select more than one edge unless they're tangentially connected, and I have the option set to use tangent edges. I don't think it behaved like that before. I'll check with someone at Autodesk to see if there is a behavior change and if it's intentional.

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

Hey Brian!

I really do appreciate it, thanks!

Brad Anderson Jr
Fusion 360 Hobbyist
Fusion 360 Luthiers Facebook Group
Message 4 of 4
BrianEkins
in reply to: BradAndersonJr

I tested this some more and now realize I didn't fully understand how to use the command. What I thought was a problem is OK. However, it's possible that some behavior did change and is causing your program to break. Attached is a modified version of your program that gets past the problem you were having. There is some behavior that I don't fully understand and could be a bug.

 

The initial problem is that the Offset feature returned two bodies, and you were trying to extend the wrong one. I changed the code to get the offset face differently. Also, when offsetting, you were offsetting the first four edges of the body. I changed it to offset all edges so it extends the face all around.

 

It then runs into a problem when working with a sketch where it's trying to use an index for a line that doesn't exist. I didn't go any further than this because I think this is a logic problem in the code, and I don't understand the workflow. 

---------------------------------------------------------------
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