Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to work with design.rootComponent.features.pipeFeatues.createInput() in py

Anonymous

How to work with design.rootComponent.features.pipeFeatues.createInput() in py

Anonymous
Not applicable

Hey 

 

I'm trying to build some automated tool with the Fusion 360 API. At the moment I find it very hard to find clear documentation on all the functions. 

 

Here is where I'm stuck, when trying to create a pipe for a selection of lines the .createInput() function keeps trowing me the error like below. 

Traceback (most recent call last):
  File "/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/testGrid/testGrid.py", line 159, in run
    draw_path(path)
  File "/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts/testGrid/testGrid.py", line 132, in draw_path
    pipeInput = pipeDraw.createInput()
  File "/Library/Application Support/Autodesk/webdeploy/production/078c0152f608cb87272eeb7be2226a5f77176092/Autodesk Fusion 360.app/Contents/Api/Python/packages/adsk/fusion.py", line 18063, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, PipeFeatures, name)
  File "/Library/Application Support/Autodesk/webdeploy/production/078c0152f608cb87272eeb7be2226a5f77176092/Autodesk Fusion 360.app/Contents/Api/Python/packages/adsk/fusion.py", line 57, in _swig_getattr
    raise AttributeError(name)
AttributeError: createInput

This looks to me that the design.rootComponent.features.pipeFeatues has no atribute named createInput. Where can I find the functions/atributes that design.rootComponent.features.pipeFeatues does have? All other design.rootComponent.features seem to work with the createInput.

 

Here is my code:

def draw_path(path):
    app = adsk.core.Application.get()
    design = app.activeProduct

    # Get the root component of the active design.
    rootComp = design.rootComponent

    # Create a new sketch on the xy plane.
    sketches = rootComp.sketches
    xyPlane = rootComp.xYConstructionPlane
    sketch = sketches.add(xyPlane)

    # Draw two connected lines.
    lines = sketch.sketchCurves.sketchLines
    h = path[0]
    for point in path:
        lines.addByTwoPoints(adsk.core.Point3D.create(h[0], h[1], 0), adsk.core.Point3D.create(point[0], point[1], 0)) # in cm
        h = point
    
    pipeDraw = rootComp.features.pipeFeatues
# Error occurs in the next line -> pipeInput = pipeDraw.createInput() # Also tried: pipeDraw.createInput( lines, adsk.fusion.FeatureOperations.NewBodyFeatureOperation) rev = pipeDraw.add(pipeInput)

*ps there seems to be a typo in the API pipeFeatues instead of pipeFeatures

 

Any help or links to the documentation I seek are highly appreciated!

Steven

0 Likes
Reply
Accepted solutions (1)
834 Views
3 Replies
Replies (3)

kandennti
Mentor
Mentor
Accepted solution
1 Like

Anonymous
Not applicable

Although not really a solution, it is a work around. Thanks @kandennti!

0 Likes

JesusFreke
Advocate
Advocate

Some of the feature types exposed in the api are read-only, which allow you to access the properties of existing features created via the UI, but don't allow you to actually create new instances of the feature via the API. This appears to be one of those.

0 Likes