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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sketch creation in 3D space

Message 1 of 3
134 Views, 2 Replies

Sketch creation in 3D space


I would like to know if there is a simple way to create a new sketch in 3D space that is not on one of the default construction planes (XY, XZ, YZ) ?


Thank you !

Message 2 of 3

Yes, the API allows that.


Here's a variation of one of the samples that creates a new construction plane at an angle from the XZ construction plane.


Screen Shot 2022-06-17 at 8.29.07 AM.png



import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
        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 sketch
        sketches = rootComp.sketches
        sketch = sketches.add(rootComp.xZConstructionPlane)

        # Create custom construction plane
        planes = rootComp.constructionPlanes        

        # Create construction plane input
        planeInput = planes.createInput()
        # Create sketch line on XZ construction plane
        sketchLines = sketch.sketchCurves.sketchLines
        startPoint = adsk.core.Point3D.create(5, 5, 0)
        endPoint = adsk.core.Point3D.create(5, 10, 0)
        sketchLineOne = sketchLines.addByTwoPoints(startPoint, endPoint)
        endPointTwo = adsk.core.Point3D.create(10, 5, 0)
        sketchLineTwo = sketchLines.addByTwoPoints(startPoint, endPointTwo)

        # Add custom construction plane by angle
        angle = adsk.core.ValueInput.createByString('30.0 deg')
        planeInput.setByAngle(sketchLineOne, angle, rootComp.xZConstructionPlane)
        planeAtAngle = planes.add(planeInput)

        # Get the health state of the plane
        health = planeAtAngle.healthState
        if health == adsk.fusion.FeatureHealthStates.ErrorFeatureHealthState or health == adsk.fusion.FeatureHealthStates.WarningFeatureHealthState:
            message = planeAtAngle.errorOrWarningMessage
        # Create a new sketch on the angled plane.
        sketch = rootComp.sketches.add(planeAtAngle)

        # Create an object collection for the points.
        points = adsk.core.ObjectCollection.create()

        # Define the points the spline with fit through.
        points.add(adsk.core.Point3D.create(0, 0, 0))
        points.add(adsk.core.Point3D.create(5, 1, 0))
        points.add(adsk.core.Point3D.create(6, 4, 3))
        points.add(adsk.core.Point3D.create(7, 6, 6))
        points.add(adsk.core.Point3D.create(2, 3, 0))
        points.add(adsk.core.Point3D.create(0, 1, 0))

        # Create the spline.
        spline = sketch.sketchCurves.sketchFittedSplines.add(points)

        # Get spline fit points
        fitPoints = spline.fitPoints
        # Get the second fit point
        fitPoint = fitPoints.item(1)
        # If there is no the relative tangent handle, activate the tangent handle
        line = spline.getTangentHandle(fitPoint)
        if line is None:
             line = spline.activateTangentHandle(fitPoint)
        # Get the tangent handle           
        gottenLine = spline.getTangentHandle(fitPoint)
        # Delete the tangent handle

        # Activate the curvature handle
        # If the curvature handle activated. the relative tangentHandle is activated automatically
        activatedArc= spline.activateCurvatureHandle(fitPoint)
        # Get curvature handle and tangent handle
        gottenArc= spline.getCurvatureHandle(fitPoint)
        gottenLine = spline.getTangentHandle(fitPoint)
        # Delete curvature handle

        if ui:

Hans Kellner
Senior Manager, Principal Engineer
Message 3 of 3

A sketch must be created on a plane, which can be either a construction plane, a planar face. or a profile in another sketch. In a parametric design, the sketch maintains this relationship to the selected planar entity and recomputes if the plane changes. Because of this associative relationship, you can't directly reposition or reorient the sketch.


However, in a non-parametric design, there are no parametric relationships and you can reorient a sketch in any way you would like. You can take advantage of this capability in a parametric model by using a base feature. When you create a base feature in a parametric model, the geometry created within the base feature is not parametric. In this case, you can create a base feature, create a sketch in the base feature and reorient it how you would like, then exit the base feature and use the sketch for parametric operations. Another option is to create a construction plane in the base feature. Because it's not parametric, you can reposition the construction plane in any way you would like. After exiting the base feature, you can create a sketch on the construction plane. You can now manipulate the sketch position by editing the position of the construction plane.


Since I don't know what it is you're trying to accomplish, these are just some ideas for you to play with.

Brian Ekins
Inventor and Fusion 360 API Expert

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