<?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: Can't use MeasureManager.getMinimumDistance on temporary brep objects? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10337920#M8794</link>
    <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6746157"&gt;@JesusFreke&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using the MeasureMinimumDistance method, the BRepbody created by TemporaryBRepManager could not be used.&lt;/P&gt;
&lt;P&gt;You need to use the BRepbody created by bRepBodies.add.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script
import adsk.core, adsk.fusion, traceback

def run(context):
    ui = adsk.core.UserInterface.cast(None)
    try:
        app :adsk.fusion.Application = adsk.core.Application.get()
        ui = app.userInterface
        app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
        des :adsk.fusion.Design = app.activeProduct

        Point3D = adsk.core.Point3D
        sphere1 = adsk.fusion.TemporaryBRepManager.get().createSphere(Point3D.create(0, 0, 0), 1)
        sphere2 = adsk.fusion.TemporaryBRepManager.get().createSphere(Point3D.create(3, 0, 0), 1)
        # result = adsk.core.Application.get().measureManager.measureMinimumDistance(sphere1, sphere2) #ng


        root :adsk.fusion.Component = des.rootComponent
        bodies :adsk.fusion.BRepBodies = root.bRepBodies
        des.designType = adsk.fusion.DesignTypes.DirectDesignType
        sphereBody1 = bodies.add(sphere1)
        sphereBody2 = bodies.add(sphere2)
        result = adsk.core.Application.get().measureManager.measureMinimumDistance(sphereBody1, sphereBody2)

        print(result.value)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 25 May 2021 12:53:08 GMT</pubDate>
    <dc:creator>kandennti</dc:creator>
    <dc:date>2021-05-25T12:53:08Z</dc:date>
    <item>
      <title>Can't use MeasureManager.getMinimumDistance on temporary brep objects?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10337335#M8793</link>
      <description>&lt;P&gt;I was a bit surprised to find that when I try to use MeasureManager.getMinimumDistance() on temporary brep objects, I get an "invalid argument" error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;RuntimeError: 3 : invalid argument geometryOne&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workaround of course is to create an occurrence and add the bodies, and then use the imported, non-temporary bodies. But I generally prefer to work with temporary brep objects when possible, for speed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was just wondering if there was some technical limitation that prevents this, or maybe it's just an oversight? And if so, could support be added for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    sphere1 = adsk.fusion.TemporaryBRepManager.get().createSphere(Point3D.create(0, 0, 0), 1)
    sphere2 = adsk.fusion.TemporaryBRepManager.get().createSphere(Point3D.create(2, 0, 0), 1)
    result = adsk.core.Application.get().measureManager.measureMinimumDistance(sphere1, sphere2)
    print(result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 09:06:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10337335#M8793</guid>
      <dc:creator>JesusFreke</dc:creator>
      <dc:date>2021-05-25T09:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use MeasureManager.getMinimumDistance on temporary brep objects?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10337920#M8794</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6746157"&gt;@JesusFreke&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using the MeasureMinimumDistance method, the BRepbody created by TemporaryBRepManager could not be used.&lt;/P&gt;
&lt;P&gt;You need to use the BRepbody created by bRepBodies.add.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script
import adsk.core, adsk.fusion, traceback

def run(context):
    ui = adsk.core.UserInterface.cast(None)
    try:
        app :adsk.fusion.Application = adsk.core.Application.get()
        ui = app.userInterface
        app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
        des :adsk.fusion.Design = app.activeProduct

        Point3D = adsk.core.Point3D
        sphere1 = adsk.fusion.TemporaryBRepManager.get().createSphere(Point3D.create(0, 0, 0), 1)
        sphere2 = adsk.fusion.TemporaryBRepManager.get().createSphere(Point3D.create(3, 0, 0), 1)
        # result = adsk.core.Application.get().measureManager.measureMinimumDistance(sphere1, sphere2) #ng


        root :adsk.fusion.Component = des.rootComponent
        bodies :adsk.fusion.BRepBodies = root.bRepBodies
        des.designType = adsk.fusion.DesignTypes.DirectDesignType
        sphereBody1 = bodies.add(sphere1)
        sphereBody2 = bodies.add(sphere2)
        result = adsk.core.Application.get().measureManager.measureMinimumDistance(sphereBody1, sphereBody2)

        print(result.value)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 25 May 2021 12:53:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10337920#M8794</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2021-05-25T12:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use MeasureManager.getMinimumDistance on temporary brep objects?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10339038#M8795</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3787950"&gt;@kandennti&lt;/a&gt;, but I'm already aware of this approach, as mentioned in my original post. My question is more for the autodesk folks, if support for temporary brep objects could be added to this api. I'm not familiar with the technical details behind the api of course, but on the surface, it seems like it should be an easy fix.&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 19:13:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10339038#M8795</guid>
      <dc:creator>JesusFreke</dc:creator>
      <dc:date>2021-05-25T19:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use MeasureManager.getMinimumDistance on temporary brep objects?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10340364#M8796</link>
      <description>&lt;P&gt;I'm sorry, I didn't read it carefully.&lt;BR /&gt;It would certainly be attractive if I could measure the BRepBody created with TemporaryBRepManager, since it would not corrupt the data.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 08:23:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10340364#M8796</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2021-05-26T08:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use MeasureManager.getMinimumDistance on temporary brep objects?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10374261#M8797</link>
      <description>&lt;P&gt;Jesus,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The default implementation is based on selections, and transient BRep entities don't support selection (of course, because they don't belong to the scene).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But measure can be enabled for transient BRep entities. This change should be available in an early July release. FWIW: This is tracked with issue #FUS-84118.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kris&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jun 2021 20:25:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/can-t-use-measuremanager-getminimumdistance-on-temporary-brep/m-p/10374261#M8797</guid>
      <dc:creator>KrisKaplan</dc:creator>
      <dc:date>2021-06-08T20:25:53Z</dc:date>
    </item>
  </channel>
</rss>

