Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Sketch project method in API creates unlinked geometry after the September update 2.0.14104.

Maciej_Rogowski
Enthusiast

Sketch project method in API creates unlinked geometry after the September update 2.0.14104.

Maciej_Rogowski
Enthusiast
Enthusiast

I noticed after the September update 2.0.14104 that the sketch project method in API creates unlinked geometry.

import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        design = app.activeProduct
        rootComp = design.rootComponent

        xYPlane = rootComp.xYConstructionPlane
        sketches = rootComp.sketches
        sketch = sketches.add(xYPlane)
        sketch.project(rootComp.xConstructionAxis)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

View.PNG

It partially breaks some of my add-ins.

0 Likes
Reply
387 Views
2 Replies
Replies (2)

BrianEkins
Mentor
Mentor

It looks like this has been fixed in the latest update.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
1 Like

Maciej_Rogowski
Enthusiast
Enthusiast

Thank you very much for the fix. I noticed also after the September update 2.0.14337 that the sketch project method in API creates misplaced geometry if the parent component of the sketch has a different location than the parent component of the projected entity:

import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        design = app.activeProduct
        rootComp = design.rootComponent
        
        matrix = adsk.core.Matrix3D.create()
        matrix.translation = adsk.core.Vector3D.create(0, 1, 0)
        occ = rootComp.occurrences.addNewComponent(matrix)
        comp = occ.component

        xYPlane = comp.xYConstructionPlane
        sketches = comp.sketches
        sketch = sketches.add(xYPlane)
        sketch.project(rootComp.xConstructionAxis)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

Component.PNG

It breaks one of my add-ins, when components have different locations.

 

0 Likes