Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started with Fusion 360’s API Brian Ekins Fusion 360 API Designer.

Similar presentations


Presentation on theme: "Getting Started with Fusion 360’s API Brian Ekins Fusion 360 API Designer."— Presentation transcript:

1 Getting Started with Fusion 360’s API Brian Ekins Fusion 360 API Designer

2  Know about scripts and add-ins  Have a basic understanding of the Object Model  Know the capabilities and limitations of the Fusion 360 API  Know how to use the tools to write, run, and debug programs  Know how to access and use the API documentation Key learning objectives

3 Legacy Python API

4  API preview introduced in September 2014 release  September release supported Javascript scripts  November release added support for Python scripts  March release added support for add-ins  Future release will support C++ New Fusion API

5  Multiple languages but a single API  Initial API design is language agnostic  Wrappers get created for each language  Uses hierarchical object model to structure the API  Objects – Represent Fusion objects and API specific objects  Object model shows ownership, not inheritance  Collections – Provide access to a set of related objects and support creating new objects. New Fusion API

6 API Object Model

7 Create an Extrusion 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. sketch = rootComp.sketches.add(rootComp.xYConstructionPlane) # Draw a circle. circles = sketch.sketchCurves.sketchCircles circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(0, 0, 0), 2) # Get the profile defined by the circle. prof = sketch.profiles.item(0) # Create an extrusion input to be able to define the input needed for an extrusion # while specifying the profile and that a new component is to be created extrudes = rootComp.features.extrudeFeatures extInput = extrudes.createInput(prof, adsk.fusion.FeatureOperations.NewComponentFeatureOperation) # Define that the extent is a distance extent of 5 cm. extInput.setDistanceExtent(False, adsk.core.ValueInput.createByReal(5)) # Create the extrusion. ext = extrudes.add(extInput)

8  Most of what you can do manually in the UI.  Example What Can I Do With the API?

9  Features and timeline  Sketches  Construction geometry  Parameters  Materials  Appearances  Basic A360 access Current Functionality in green (as of March release)

10  Assembly structure (Components and Occurrences)  B-Rep and geometry query (including mesh extraction)  User Preferences  Camera related functionality  Commands and UI access  Add-Ins Current Functionality (as of March release)

11  C++ Support  Assembly Joints and other assembly functionality  Remaining features  T-Splines  Custom graphics  Drawings  CAM  And much more… Future Functionality

12  JavaScript  Used as a general-purpose language  Cannot use html for GUI  No built-in file system access  Use any text editor to write (Brackets comes with Fusion)  Debugging is done in Chrome or Webkit browser  Runs out-of-process in its own invisible browser instance  Can use external JavaScript libraries Choosing a Language

13  Python  Runs in-process to Fusion in its own Python interpreter  Faster than JavaScript (275x, 23x)  Full access to the file system  Can use any editor to edit (Spyder comes with Fusion)  Uses Spyder for debugging  Python comes with Tkinter for GUI development (doesn’t work on Mac)  Can use other Python libraries Choosing a Language

14 Script Example (Javascript) var app = adsk.core.Application.get(); var design = app.activeProduct; // Get the root component of the active design. var rootComp = design.rootComponent; // Create a new sketch on the xy plane. var sketches = rootComp.sketches; var xyPlane = rootComp.xYConstructionPlane; var sketch = sketches.add(xyPlane); // Draw a circle. var circles = sketch.sketchCurves.sketchCircles; var circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(0, 0, 0), 2); // Constrain the circle size. sketch.sketchDimensions.addDiameterDimension(circle1, adsk.core.Point3D.create(3, 3, 0));

15 Script Example (Python) 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 a circle. circles = sketch.sketchCurves.sketchCircles circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(0, 0, 0), 2) # Constrain the circle size. sketch.sketchDimensions.addDiameterDimension(circle1, adsk.core.Point3D.create(3, 3, 0))

16  Scripts are usually “run and done”.  Add-Ins usually run at startup and remain running.  Add-Ins require an additional manifest file.  Fusion expects certain functions to be implemented.  Scripts can optionally use a manifest and implement the same functions. Scripts vs. Add-Ins

17  Access existing Scripts and Add- Ins  Run scripts  Start add-ins  Create new scripts and add-ins  Edit existing scripts and add-ins  Debug scripts and add-ins  Easy access to many samples Scripts and Add-Ins

18  Can be used by scripts and add-ins  Fusion has well-defined concept of a “command”.  Command definition defines the information needed to create a button.  Command is created when user clicks the command button.  Can create command inputs which results in a dialog.  Can validate input as user interacts with the inputs.  Can show a preview of the result.  Transactions (Undo) are automatically handled. Fusion Commands

19 Documentation

20 Fusion 360 API Forum

21  Install Fusion 360 (fusion360.autodesk.com)  Use Fusion  Look at the API documentation  Run and look at the sample programs  Use the API Forum  Let us know what you need Getting Started With the API

22 Autodesk is a registered trademark of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product and services offerings, and specifications and pricing at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. © 2013 Autodesk, Inc. All rights reserved.


Download ppt "Getting Started with Fusion 360’s API Brian Ekins Fusion 360 API Designer."

Similar presentations


Ads by Google