<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sketching on one sketch for sweeping feature in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10601848#M8033</link>
    <description>&lt;P&gt;I ran the script you provided but nothing happend !&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I wanted to do is to sketch one full path that consists of both lines and arcs.&lt;/P&gt;&lt;P&gt;For example Imagine I want to draw a staright line then connect to it an arc then the end point of the arc has another straight line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm getting is that the second line is starting from the end of the first line and not the end of the arc.&amp;nbsp; Eventhough I'm using the command of endSketchPoint in order to keep the sketch as one full path and not segments.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following example shows only lines connected to each other&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/python-script-to-create-a-chain-of-lines/td-p/7518674" target="_blank"&gt;Solved: Python script to create a chain of lines - Autodesk Community - Fusion 360&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Sep 2021 03:44:28 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-09-06T03:44:28Z</dc:date>
    <item>
      <title>Sketching on one sketch for sweeping feature</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10600650#M8031</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Previously I was able to draw one full path as one sketch using connected lines using this command&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;sketch_lines&amp;nbsp;=&amp;nbsp;theSketch.sketchCurves.sketchLines.addByTwoPoints(theSketchLine.endSketchPoint,&amp;nbsp;linePoints[iPt])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;It was working perfectly fine.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Now the issue is that, in this same sketch there are small lines creating curves, so I planned to re-create the curve by using three points Arc command as seen below&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;arcStartPoint = theSketchLine.endSketchPoint
arcEndPoint = linePoints[iPt]
areJoiningPoint = linePoints[iPt-1]
sketch_curves = theSketch.sketchCurves.sketchArcs.addByThreePoints(arcStartPoint, areJoiningPoint, arcEndPoint)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;The issue is that the arcStartPoint is correct where it start at the endSketchpoint of the line, while the next line doesn't actually start at the end of the sketchpoint of the arc !&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I think whats causing the issue is that sketchArcs and sketchLines are different skitches and they are not syncronized ? I don't know, Any ideas ?&lt;/DIV&gt;</description>
      <pubDate>Sun, 05 Sep 2021 10:48:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10600650#M8031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-05T10:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sketching on one sketch for sweeping feature</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10601658#M8032</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure what you are trying to do.&lt;/P&gt;
&lt;P&gt;For now, I created a test code like this, but I could not find anything wrong with addByThreePoints.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core

def run(context):
    ui: adsk.core.UserInterface = None
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface

        msg: str = 'Select Sketch Curve'
        selFiltter: str = 'SketchCurves'
        sel: adsk.core.Selection = selectEnt(msg, selFiltter)
        if not sel:
            return

        # get points
        crv: adsk.fusion.SketchCurve = sel.entity
        pnts = getPoints(crv, 0.1)

        # lines
        createLines(pnts)

        # arcs
        createArcs(pnts)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def createArcs(
        pnts: list):

    app: adsk.core.Application = adsk.core.Application.get()
    des: adsk.fusion.Design = app.activeProduct
    root: adsk.fusion.Component = des.rootComponent

    skt: adsk.fusion.Sketch = root.sketches.add(root.xYConstructionPlane)
    skt.name = 'Arcs'

    sktPnts = createPoints(pnts, skt)

    startPoints = sktPnts[0::2]
    joiningPoints = [p.geometry for p in sktPnts[1::2]]
    endPoints = sktPnts[2::2]

    for p1, p2, p3 in zip(startPoints, joiningPoints, endPoints):
        skt.sketchCurves.sketchArcs.addByThreePoints(p1, p2, p3)


def createLines(
        pnts: list):

    app: adsk.core.Application = adsk.core.Application.get()
    des: adsk.fusion.Design = app.activeProduct
    root: adsk.fusion.Component = des.rootComponent

    skt: adsk.fusion.Sketch = root.sketches.add(root.xYConstructionPlane)
    skt.name = 'Lines'

    sktPnts = createPoints(pnts, skt)

    startPoints = sktPnts[0::2]
    endPoints = sktPnts[2::2]

    for p1, p2 in zip(startPoints, endPoints):
        skt.sketchCurves.sketchLines.addByTwoPoints(p1, p2)


def createPoints(
        pnts: list,
        skt: adsk.fusion.Sketch) -&amp;gt; list:

    sktPnts = [skt.sketchPoints.add(p) for p in pnts]

    return sktPnts


def getPoints(
        crv: adsk.fusion.SketchEntity,
        tolerance: float = 0.01) -&amp;gt; list:

    eva: adsk.core.CurveEvaluator3D = crv.worldGeometry.evaluator
    _, startParameter, endParameter = eva.getParameterExtents()
    _, vertexCoordinates = eva.getStrokes(startParameter, endParameter, tolerance)
    pnts = [v for v in vertexCoordinates]

    return pnts


def selectEnt(
        msg: str,
        filtterStr: str) -&amp;gt; adsk.core.Selection:

    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        sel = ui.selectEntity(msg, filtterStr)
        return sel
    except:
        return None&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Sep 2021 00:41:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10601658#M8032</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2021-09-06T00:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sketching on one sketch for sweeping feature</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10601848#M8033</link>
      <description>&lt;P&gt;I ran the script you provided but nothing happend !&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I wanted to do is to sketch one full path that consists of both lines and arcs.&lt;/P&gt;&lt;P&gt;For example Imagine I want to draw a staright line then connect to it an arc then the end point of the arc has another straight line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm getting is that the second line is starting from the end of the first line and not the end of the arc.&amp;nbsp; Eventhough I'm using the command of endSketchPoint in order to keep the sketch as one full path and not segments.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following example shows only lines connected to each other&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/python-script-to-create-a-chain-of-lines/td-p/7518674" target="_blank"&gt;Solved: Python script to create a chain of lines - Autodesk Community - Fusion 360&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 03:44:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10601848#M8033</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-06T03:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sketching on one sketch for sweeping feature</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10602050#M8034</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd love to help, but I can't reproduce the situation with only partial code.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 06:24:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10602050#M8034</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2021-09-06T06:24:37Z</dc:date>
    </item>
    <item>
      <title>Sketching on one sketch for sweeping feature</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10605558#M8035</link>
      <description>&lt;P&gt;Arcs behave differently than lines. Once an arc is created, it ALWAYS exists in a counterclockwise direction. This can mean that you can create the arc specifying the start and end points but when you query the existing arc, the start and end point may be different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the example below, I can create the arc by three points using points 1, 2, 3, or 3, 2, 1.&amp;nbsp; However, when I query the arc to get the start and end sketch points, the start point will be 1 and the end will be point 3 because it is counterclockwise.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="ArcSample.png" style="width: 154px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/962207iAA19E5B8EAEB4AAF/image-size/large?v=v2&amp;amp;px=999" role="button" title="ArcSample.png" alt="ArcSample.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 13:53:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketching-on-one-sketch-for-sweeping-feature/m-p/10605558#M8035</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2021-09-07T13:53:24Z</dc:date>
    </item>
  </channel>
</rss>

