Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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()))
Solved! Go to Solution.