Moving Existing Points in a sketch

Moving Existing Points in a sketch

Anonymous
Not applicable
576 Views
2 Replies
Message 1 of 3

Moving Existing Points in a sketch

Anonymous
Not applicable

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,

0 Likes
577 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

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

0 Likes
Message 3 of 3

marshaltu
Autodesk
Autodesk

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 Developer
>
0 Likes