I've modified this sample here.
http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ecd3b76b-19f7-4efa-8a02-087c16da246f
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
# doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
design = app.activeProduct
# Get the root component of the active design.
rootComp = design.rootComponent
# Create a new sketch on the xy plane.
sketches = rootComp.sketches
# xyPlane = rootComp.xYConstructionPlane
try:
returnValue = ui.selectEntity('Select Face', 'PlanarFaces')
except:
return
xyPlane = returnValue.entity
sketch = sketches.add(xyPlane)
# Draw some circles.
circles = sketch.sketchCurves.sketchCircles
circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(0, 0, 0), 2)
circle2 = circles.addByCenterRadius(adsk.core.Point3D.create(8, 3, 0), 3)
# Add a circle at the center of one of the existing circles.
circle3 = circles.addByCenterRadius(circle2.centerSketchPoint, 4)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
I wanted everything to be public, including the declaration part.