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: 

I am atta

2 REPLIES 2
Reply
Message 1 of 3
sHubamyadav016
90 Views, 2 Replies

I am atta

I am attaching a drawing i want to make in fusio

2 REPLIES 2
Message 2 of 3
kandennti
in reply to: sHubamyadav016

Hi @sHubamyadav016 -San.

 

I don't understand what it means, but I just created the line.
There seems to be a discrepancy in the numbers.

# Fusion360API Python script

import traceback
import adsk.core as core
import adsk.fusion as fusion

def run(context):
    ui: core.UserInterface = None
    try:
        app: core.Application = core.Application.get()
        ui = app.userInterface
        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        skt: fusion.Sketch = root.sketches.add(
            root.xYConstructionPlane
        )

        coordinates = [
            (0,0,0),
            (0,158.8,0),
            (20,171.7,0),
            (20,0,0),
        ]

        create_lines(skt, coordinates)

        vp: core.Viewport = app.activeViewport
        vp.camera = des.namedViews.topNamedView.camera
        vp.fit()

        ui.messageBox("Done")


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


def create_lines(
    skt: fusion.Sketch,
    coordinates: list
) -> None:

    points = [core.Point3D.create(*c) for c in coordinates]

    sktPoints = [skt.sketchPoints.add(p) for p in points]
    sktPoints.append(sktPoints[0])

    lines: fusion.SketchLines = skt.sketchCurves.sketchLines
    for p1, p2 in zip(sktPoints, sktPoints[1:]):
        lines.addByTwoPoints(p1, p2)
Message 3 of 3

Thanks for helping I created same drawing now i have one doubt how can I create hole in top face I am attaching drawing for reference 

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