<?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: How the fusion 360 API gets the bounding box of the parameter space in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11561101#M5052</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13159471"&gt;@2544173825&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It can be obtained with the SurfaceEvaluator object.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-GUID-31dad9b2-ee1d-4216-8100-09ea44f9967a" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-GUID-31dad9b2-ee1d-4216-8100-09ea44f9967a&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have created a script that displays the parameter range of the selected surface.&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.cast(None)
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface

        msg: str = 'Select'
        selFilter: str = 'Faces'
        sel: adsk.core.Selection = selectEnt(msg, selFilter)
        if not sel:
            return

        selectFace: adsk.fusion.BRepFace = sel.entity

        eva: adsk.core.SurfaceEvaluator = selectFace.evaluator
        bBox: adsk.core.BoundingBox2D = eva.parametricRange()

        _, pointMin = eva.getPointAtParameter(bBox.minPoint)
        _, pointMax = eva.getPointAtParameter(bBox.maxPoint)

        msglst = ['-- Parameter --']
        msglst.append(f'min:{bBox.minPoint.asArray()}')
        msglst.append(f'min:{bBox.maxPoint.asArray()}')
        msglst.append('-- Position --')
        msglst.append(f'min:{pointMin.asArray()}')
        msglst.append(f'min:{pointMax.asArray()}')
        ui.messageBox('\n'.join(msglst))

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

def selectEnt(
    msg: str,
    filterStr: str) -&amp;gt; adsk.core.Selection:

    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui: adsk.core.UserInterface = app.userInterface
        sel = ui.selectEntity(msg, filterStr)
        return sel
    except:
        return None&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that "face.evaluator" and "face.geometry.evaluator" give different results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Nov 2022 04:55:49 GMT</pubDate>
    <dc:creator>kandennti</dc:creator>
    <dc:date>2022-11-18T04:55:49Z</dc:date>
    <item>
      <title>How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11560953#M5051</link>
      <description>&lt;P&gt;I want to use the Fusion 360 API to get a parameter space bounding box, UV bounding, for a face, but I didn't find the relevant method.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 02:15:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11560953#M5051</guid>
      <dc:creator>2544173825</dc:creator>
      <dc:date>2022-11-18T02:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11561101#M5052</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13159471"&gt;@2544173825&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It can be obtained with the SurfaceEvaluator object.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-GUID-31dad9b2-ee1d-4216-8100-09ea44f9967a" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-GUID-31dad9b2-ee1d-4216-8100-09ea44f9967a&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have created a script that displays the parameter range of the selected surface.&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.cast(None)
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface

        msg: str = 'Select'
        selFilter: str = 'Faces'
        sel: adsk.core.Selection = selectEnt(msg, selFilter)
        if not sel:
            return

        selectFace: adsk.fusion.BRepFace = sel.entity

        eva: adsk.core.SurfaceEvaluator = selectFace.evaluator
        bBox: adsk.core.BoundingBox2D = eva.parametricRange()

        _, pointMin = eva.getPointAtParameter(bBox.minPoint)
        _, pointMax = eva.getPointAtParameter(bBox.maxPoint)

        msglst = ['-- Parameter --']
        msglst.append(f'min:{bBox.minPoint.asArray()}')
        msglst.append(f'min:{bBox.maxPoint.asArray()}')
        msglst.append('-- Position --')
        msglst.append(f'min:{pointMin.asArray()}')
        msglst.append(f'min:{pointMax.asArray()}')
        ui.messageBox('\n'.join(msglst))

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

def selectEnt(
    msg: str,
    filterStr: str) -&amp;gt; adsk.core.Selection:

    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui: adsk.core.UserInterface = app.userInterface
        sel = ui.selectEntity(msg, filterStr)
        return sel
    except:
        return None&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that "face.evaluator" and "face.geometry.evaluator" give different results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 04:55:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11561101#M5052</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-11-18T04:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11561205#M5053</link>
      <description>&lt;P&gt;Thanks for your prompt reply！&lt;BR /&gt;This method looks very nice, but I don't quite understand statements like msg: str = 'select' which doesn't seem to be very common in python, he seems to be declaring a string type variable, but isn't the variable declaration in python possible to use msg = 'select' directly? Are the two equivalent? Also, is there any difference between select here and the entity I get via body.faces(edges)?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 06:35:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11561205#M5053</guid>
      <dc:creator>2544173825</dc:creator>
      <dc:date>2022-11-18T06:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11561296#M5054</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13159471"&gt;@2544173825&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for ": str", it is a python type hints.&lt;BR /&gt;It has no effect on execution.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If you get it with body.faces(edges), elements in the root component are fine, but for elements in the occurrence (GUI component), you will have a problem.&lt;/P&gt;
&lt;P&gt;You need to consider about proxies here.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-88A4DB43-CFDD-4CFF-B124-7EE67915A07A" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-88A4DB43-CFDD-4CFF-B124-7EE67915A07A&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 07:32:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11561296#M5054</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-11-18T07:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11563588#M5056</link>
      <description>&lt;P&gt;I found a bug with parametricRange. When I debug a program, the first time I get a 2D bounding box through this method, it seems to be fine, but when I break the debug and start it again, there are some problems with the 2D wraparound box I get. This is reflected in the returned maxpoint, which may appear as maxpoint=minpoint, or maxpoint.y=minpoint.y. When I restart VScode and Fusion 360, it returns to normal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;for face in tem_body.faces:
    face_id = face.tempId
    face_type = face.geometry.objectType
    face_normal = face.geometry.normal
    face_reversed = face.isParamReversed
    face_are = face.area
    centroid_point = face.centroid
    point_on_face = face.pointOnFace
    uvgrid(face=face, method='point')

def uvgrid(face, num_u = 10, num_v = 10, method=None, reverse = True):
    assert num_u &amp;gt;= 2
    assert num_v &amp;gt;= 2
    eval = face.evaluator
    face_para_bounding = eval.parametricRange()
    point_max = face_para_bounding.maxPoint
    point_min = face_para_bounding.minPoint&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 06:51:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11563588#M5056</guid>
      <dc:creator>2544173825</dc:creator>
      <dc:date>2022-11-19T06:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11563673#M5057</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13159471"&gt;@2544173825&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have not tried many, but I have no such experience.&lt;BR /&gt;Is there an f3d file that can be attached?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 08:09:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11563673#M5057</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-11-19T08:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11563890#M5071</link>
      <description>&lt;P&gt;I have not .f3d file. I get part information from .smt file, but, I cannot upload .smt file. I had upload .step file.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 12:10:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11563890#M5071</guid>
      <dc:creator>2544173825</dc:creator>
      <dc:date>2022-11-19T12:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11563995#M5072</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13159471"&gt;@2544173825&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the data. smt file can be attached to the forum if you zip it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have seen the data. Perhaps the two sides here will be the problem.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 563px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1141786i4A49C9B3783F99D6/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I think it is due to the fact that they are periodic.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The periodicity can be checked by using the getParamAnomaly method.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-d6b7d30a-972b-4117-9292-c0a87be8ba62" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-d6b7d30a-972b-4117-9292-c0a87be8ba62&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have checked and U is periodic.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 13:58:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11563995#M5072</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-11-19T13:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: How the fusion 360 API gets the bounding box of the parameter space</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11566150#M5074</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 01:51:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-the-fusion-360-api-gets-the-bounding-box-of-the-parameter/m-p/11566150#M5074</guid>
      <dc:creator>2544173825</dc:creator>
      <dc:date>2022-11-21T01:51:12Z</dc:date>
    </item>
  </channel>
</rss>

