How can I draw an arc with a constant radius with python?

How can I draw an arc with a constant radius with python?

Anonymous
Not applicable
1,472 Views
1 Reply
Message 1 of 2

How can I draw an arc with a constant radius with python?

Anonymous
Not applicable

Hi, fusion 360 community

I'm a beginner at fusion360.

I want to draw an arc with a constant radius by a python script.

So I wrote this script to draw an arc with a central angle of 90 degrees and a radius of 1 cm on XZ plane. However, the results both of them were different as the picture below shows.

What should I do?

  

#Author-
#Description-

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

def run(context):
    ui = None
    try:
        pi = 3.xxx-xxxxxxxx
        app = adsk.core.Application.get()
        ui  = app.userInterface
        product = app.activeProduct
        design = adsk.fusion.Design.cast(product)
        root = design.rootComponent
        sketch = root.sketches.add(root.xZConstructionPlane)
        arcs = sketch.sketchCurves.sketchArcs
        arcs.addByCenterStartSweep(adsk.core.Point3D.create(0,0,0),adsk.core.Point3D.create(1,0,1),pi/2)
        

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

 arc.png

0 Likes
1,473 Views
1 Reply
Reply (1)
Message 2 of 2

goyals
Autodesk
Autodesk

I think you need to specify the start point adsk.core.Point3D.create(1,1,0) if you want to draw the sketch as shown in attached picture.



Shyam Goyal
Sr. Software Dev. Manager
0 Likes