<?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: Creation of Plane at Angle in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/creation-of-plane-at-angle/m-p/11852317#M4091</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3595609"&gt;@dozerdroid&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Indeed, a three-point passing plane might be a good idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I made a sample of creating a plane of three points of passage while creating the points of the sketch.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# 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
        app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)

        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        angle = 30 #degrees
        offsetZ = 1 # Z direction　offset value
        offsetCount = 10

        # Calculate transit points
        rad = math.radians(angle)
        pnts = [
            core.Point3D.create(0,0,0),
            core.Point3D.create(1, math.cos(rad), math.sin(rad)),
            core.Point3D.create(-1, math.cos(rad), math.sin(rad)),
        ]

        # Sketch creation for reference
        skt: fusion.Sketch = root.sketches.add(root.xYConstructionPlane)
        skt.name = 'Plane Reference'
        skt.isLightBulbOn = False

        sketchPnts: fusion.SketchPoints = skt.sketchPoints

        # Vector for updating transit points
        vec: core.Vector3D = core.Vector3D.create(0, 0, offsetZ)

        for _ in range(offsetCount):
            # reference point creation
            sktPnts = [sketchPnts.add(p) for p in pnts]

            # create plane
            constPlanes: fusion.ConstructionPlanes = root.constructionPlanes

            planeIpt: fusion.ConstructionPlaneInput = constPlanes.createInput()
            planeIpt.setByThreePoints(
                sktPnts[0],
                sktPnts[1],
                sktPnts[2],
            )

            constPlanes.add(planeIpt)

            # Updated transit points
            [p.translateBy(vec) for p in pnts]

        ui.messageBox('Done')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 322px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1194388iBE8D723C1F616D22/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 03:48:25 GMT</pubDate>
    <dc:creator>kandennti</dc:creator>
    <dc:date>2023-03-28T03:48:25Z</dc:date>
    <item>
      <title>Creation of Plane at Angle</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/creation-of-plane-at-angle/m-p/11850887#M4090</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt; note I think I have found a solution see bottom ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I am currently using code like below to create planes for sketches that are in the XY plane and offset on the Z axis, I have a points array which I use for the sketch in which all of the Z values are on the created XY plane&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dozerdroid_0-1679928087114.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1194134i02394D4AC195E322/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dozerdroid_0-1679928087114.png" alt="dozerdroid_0-1679928087114.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;planesObj = hullComponent.constructionPlanes&lt;BR /&gt;planeInput = planesObj.createInput()&lt;BR /&gt;xyPlane = hullComponent.xYConstructionPlane&lt;BR /&gt;planeInput.setByOffset(xyPlane, offsetValue)&lt;BR /&gt;plane0 = planesObj.add(planeInput)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now need to perform a similar task except the planes offset along the Z axis will be tilted as per below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dozerdroid_2-1679928264946.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1194139i8D6B42A2F4E76807/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dozerdroid_2-1679928264946.png" alt="dozerdroid_2-1679928264946.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not been successful so far in the API doing this so if someone can point me to an example or other help it would be appreciated. I can obviously create the plane manually by creating a plane through three points (all of the points in the array to draw line in the tilted plane) but I need to perform this in the api.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance. Khim&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok I think I have found an answer below ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;planeInput.setByThreePoints&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 23:21:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/creation-of-plane-at-angle/m-p/11850887#M4090</guid>
      <dc:creator>dozerdroid</dc:creator>
      <dc:date>2023-03-27T23:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of Plane at Angle</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/creation-of-plane-at-angle/m-p/11852317#M4091</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3595609"&gt;@dozerdroid&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Indeed, a three-point passing plane might be a good idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I made a sample of creating a plane of three points of passage while creating the points of the sketch.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# 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
        app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)

        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        angle = 30 #degrees
        offsetZ = 1 # Z direction　offset value
        offsetCount = 10

        # Calculate transit points
        rad = math.radians(angle)
        pnts = [
            core.Point3D.create(0,0,0),
            core.Point3D.create(1, math.cos(rad), math.sin(rad)),
            core.Point3D.create(-1, math.cos(rad), math.sin(rad)),
        ]

        # Sketch creation for reference
        skt: fusion.Sketch = root.sketches.add(root.xYConstructionPlane)
        skt.name = 'Plane Reference'
        skt.isLightBulbOn = False

        sketchPnts: fusion.SketchPoints = skt.sketchPoints

        # Vector for updating transit points
        vec: core.Vector3D = core.Vector3D.create(0, 0, offsetZ)

        for _ in range(offsetCount):
            # reference point creation
            sktPnts = [sketchPnts.add(p) for p in pnts]

            # create plane
            constPlanes: fusion.ConstructionPlanes = root.constructionPlanes

            planeIpt: fusion.ConstructionPlaneInput = constPlanes.createInput()
            planeIpt.setByThreePoints(
                sktPnts[0],
                sktPnts[1],
                sktPnts[2],
            )

            constPlanes.add(planeIpt)

            # Updated transit points
            [p.translateBy(vec) for p in pnts]

        ui.messageBox('Done')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 322px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1194388iBE8D723C1F616D22/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 03:48:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/creation-of-plane-at-angle/m-p/11852317#M4091</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2023-03-28T03:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creation of Plane at Angle</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/creation-of-plane-at-angle/m-p/11853632#M4092</link>
      <description>&lt;P&gt;Thank you kandennti&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 14:08:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/creation-of-plane-at-angle/m-p/11853632#M4092</guid>
      <dc:creator>dozerdroid</dc:creator>
      <dc:date>2023-03-28T14:08:34Z</dc:date>
    </item>
  </channel>
</rss>

