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: 

LOFT NOT INCLUDING FACES

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
daddysomeones
151 Views, 2 Replies

LOFT NOT INCLUDING FACES

So I'm new to very new to python and the fusion 360 API. I'm trying to create a solid nozzle but when I loft it creates a hollow surface and doesn't include the circles at each end in the loft. Please help.

here's my code.

 

 

 

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

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        ui.messageBox('NOZZLE DESIGN 1')
        design = app.activeProduct
        rootComp = design.rootComponent
        features = rootComp.features
        extrudes = rootComp.features.extrudeFeatures
        lofts = rootComp,features.loftFeatures
        sketches = rootComp.sketches
        plane1 =  rootComp.yZConstructionPlane
        plane2 =  rootComp.yZConstructionPlane
        plane3 =  rootComp.yZConstructionPlane
        originPt = adsk.core.Point3D.create(0, 0, 0)
        endPt = adsk.core.Point3D.create(0, 0, 737.291)
        midPt = adsk.core.Point3D.create(0, 0, 368.646)
        sketch1 = sketches.add(plane1)
        sketch2 = sketches.add(plane2)
        sketch3 = sketches.add(plane3)

        circle1 = sketch1.sketchCurves.sketchCircles
        circle1.addByCenterRadius(originPt, 100.92/2)
        profile1 = sketch1.profiles.item(0)

        circle3 = sketch3.sketchCurves.sketchCircles
        circle3.addByCenterRadius(midPt, 25)
        profile3 = sketch3.profiles.item(0)


        circle2 = sketch2.sketchCurves.sketchCircles
        circle2.addByCenterRadius(endPt, 100.92/2)
        profile2 = sketch2.profiles.item(0)

       
        # Create loft feature input
        loftFeats = rootComp.features.loftFeatures
        loftInput = loftFeats.createInput(adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
        loftSectionsObj = loftInput.loftSections
        loftSectionsObj.add(profile1)
        loftSectionsObj.add(profile3)
        loftSectionsObj.add(profile2)
        loftInput.isSolid = False

        # Create loft feature
        loftFeats.add(loftInput)
        

        
            
       
            
        




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

 

Labels (2)
2 REPLIES 2
Message 2 of 3
kandennti
in reply to: daddysomeones

Hi @daddysomeones .

 

If you want to create it as solid, do the following

 

        loftInput.isSolid = True


or if you do not specify the isSolid property, it will still be solid.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-BA888784-2275-4CCC-82E5-2E24E2D5E15C 

 

Your coding style looks like VBA.

 

Message 3 of 3
daddysomeones
in reply to: kandennti

Thank you very much that did the trick. Whats VBA? I'm really quite new to this

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