LOFT NOT INCLUDING FACES

LOFT NOT INCLUDING FACES

daddysomeones
Explorer Explorer
703 Views
2 Replies
Message 1 of 3

LOFT NOT INCLUDING FACES

daddysomeones
Explorer
Explorer

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

 

0 Likes
Accepted solutions (1)
704 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Accepted solution

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.

 

0 Likes
Message 3 of 3

daddysomeones
Explorer
Explorer

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

0 Likes