- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm new to Fusion 360 API and object oriented programming.
It's very interesting. I'm studing the simple examples of the help.
I would like to understand why it's not possible write this kind of code.
Thank you very much.
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
design = app.activeProduct
# Get the root component of the active design.
rootComp = design.rootComponent
# Create a new sketch on the xy plane.
sketch = rootComp.sketches.add(rootComp.xYConstructionPlane)
# Create an object collection for the points.
points[0] = adsk.core.ObjectCollection.create()
# Define the points the spline with fit through.
points[0].add(adsk.core.Point3D.create(0, 0, 0))
points[0].add(adsk.core.Point3D.create(5, 1, 0))
points[0].add(adsk.core.Point3D.create(6, 4, 3))
# Create the spline.
spline[0]=sketch.sketchCurves.sketchFittedSplines.add(points[0])
# Create an object collection for the points.
points[1] = adsk.core.ObjectCollection.create()
points[1].add(adsk.core.Point3D.create(7, 6, 6))
points[1].add(adsk.core.Point3D.create(2, 3, 0))
points[1].add(adsk.core.Point3D.create(0, 1, 0))
# Create the spline.
spline[1]=sketch.sketchCurves.sketchFittedSplines.add(points[1])
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
There is another way to use array of spline ?
Thank you very much.
Dino
Solved! Go to Solution.