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

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

2 REPLIES 2
Reply
Message 1 of 3
Maciej_Rogowski
163 Views, 2 Replies

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

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.

2 REPLIES 2
Message 2 of 3

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

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.

 

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