Hi @fliesblindthroughcrapstorms -San.
The following sample rotates the sketch curve of a given sketch.
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
import math
def run(context):
ui: core.UserInterface = None
try:
app: core.Application = core.Application.get()
ui = app.userInterface
msg: str = 'Select Sketch'
selFilter: str = 'Sketches'
sel: core.Selection = selectEnt(msg, selFilter)
if not sel:
return
exec_rotation_sketchCurves(sel.entity, 45)
ui.messageBox('Done')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def exec_rotation_sketchCurves(
skt: fusion.Sketch,
angle: float, # unit deg
) -> None:
crvs = [c for c in skt.sketchCurves]
if len(crvs) < 1:
return
mat: core.Matrix3D = core.Matrix3D.create()
mat.setToRotation(
math.radians(angle),
core.Vector3D.create(0, 0, 1),
core.Point3D.create(0, 0, 0),
)
skt.move(
core.ObjectCollection.createWithArray(crvs),
mat,
)
def selectEnt(
msg: str,
filterStr: str
) -> core.Selection:
try:
app: core.Application = core.Application.get()
ui: core.UserInterface = app.userInterface
sel = ui.selectEntity(msg, filterStr)
return sel
except:
return None