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

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

Maciej_Rogowski
Enthusiast Enthusiast
433 Views
2 Replies
Message 1 of 3

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
434 Views
2 Replies
Replies (2)
Message 2 of 3

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
Message 3 of 3

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