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: 

Moving Existing Points in a sketch

2 REPLIES 2
Reply
Message 1 of 3
michael.graybar
279 Views, 2 Replies

Moving Existing Points in a sketch

Looking for some sample code on how to move a specified point on a spline in a sketch. This could be really useful for editing existing sketch geometry instead of always creating new, Like in the Fusion gear program I am always having to create a new component instead of editing the existing on. Thanks,

2 REPLIES 2
Message 2 of 3

Are you looking for scripts to move points in a sketch?

Message 3 of 3
marshaltu
in reply to: michael.graybar

Hello,

 

The following is the sample how to edit start point on a spline in a sketch. You can give a try and see if it is what you wanted. In addition, we do provide the functionality to edit existing sketch geometry and other objects. Please let me know if anything you need for edit is missing.

 

PS: you need create a spline and pre-select it to run the sample.

 

#Author-
#Description-

import adsk.core, adsk.fusion, adsk.cam, traceback

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

        spline = adsk.fusion.SketchFittedSpline.cast(ui.activeSelections.item(0).entity)
        startpt = spline.startSketchPoint
        startpt.move(adsk.core.Vector3D.create(1, 0, 0))

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

Thanks,

Marshal



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

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