<?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: Nurbs surfaces in Fusion using the API in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11090386#M6263</link>
    <description>&lt;P&gt;I just noticed I replied to myself, so here I go again.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;I got me in the right direction, but there still is a lot I don't really understand.&lt;/P&gt;&lt;P&gt;For testing purposes, I imported a STP file that contains a single Nurbs surface (see attached image), and I ended up with this:&lt;/P&gt;&lt;P&gt;1) A body in the rootComponent.bRepBodies collection&lt;BR /&gt;2) Te body has a single lump / shell&lt;BR /&gt;3) The shell / lump has a single face, whose geometry is an adsk.core.NurbsSurface instance&lt;BR /&gt;4) The face's single loop has 4 edges, whose geometries are all adsk.core.NurbsCurve3D instances&lt;/P&gt;&lt;P&gt;All of this is as I expected, although I suspect it will a little bit painful to reproduce this programmtically.&lt;/P&gt;&lt;P&gt;But what I would like to find is a complete example of how to achieve the same result programmatically, given all the required Nrbs surface info (control points, U and V control point count, U and V degress, etc.).&lt;/P&gt;&lt;P&gt;In the suggested example ( &lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a" target="_blank"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a&lt;/A&gt; ), we're almost there, but the temporary NurbsSurface / resulting body is added to the customGraphicsGroups, which is not what I want ultimately.&lt;/P&gt;&lt;P&gt;How can that body be added to the rootComponent bRepBodies collection ? I tried to use th bRepBodies.add method but that didn't work, and quite frankly I don't really understand what is missing for this to be working.&lt;/P&gt;&lt;P&gt;Thansk for any advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Apr 2022 13:19:28 GMT</pubDate>
    <dc:creator>jean-marc_langlois</dc:creator>
    <dc:date>2022-04-07T13:19:28Z</dc:date>
    <item>
      <title>Nurbs surfaces in Fusion using the API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11085482#M6260</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm very new to Fusion 360, and I am currently looking into the API to see whether or not we can have some sort of integration between our own 3d modeling software and Fusion, mostly for reverse engineering purposes.&lt;/P&gt;&lt;P&gt;I've been looking around in the API, samples, etc. for a way to add a Nurbs surface in the active design, without any success so far. I've found a way to do just that for a nurbs curve (using the "&lt;SPAN&gt;addByNurbsCurve" method in&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;sketchFixedSplines or&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;sketchFittedSplines classes, but couldn't find a similar "addByNurbsSurface"&amp;nbsp; method.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also stumbled across the transient NurbsSurface class, but once an instance is created, what can we do with it ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance for any comments.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 19:58:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11085482#M6260</guid>
      <dc:creator>jean-marc_langlois</dc:creator>
      <dc:date>2022-04-05T19:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Nurbs surfaces in Fusion using the API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11085915#M6261</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3817597"&gt;@jean-marc_langlois&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The NurbsSurface.create method is used in this sample.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since it is difficult for me to understand, I would consider using a Feature such as Sweep, Loft, Patch, etc.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=SampleList" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=SampleList&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 457px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1050941i8AF25A1CF679DC18/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>Wed, 06 Apr 2022 00:19:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11085915#M6261</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-04-06T00:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Nurbs surfaces in Fusion using the API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11090343#M6262</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;It got me in the right direction, but there still is a lot I don't really understand...&lt;/P&gt;&lt;P&gt;For testing purposes, I imported a STP file that contains a single Nurbs surface (see attached image), and I ended up with this:&lt;/P&gt;&lt;P&gt;1) A body in the rootComponent.bRepBodies collection&lt;BR /&gt;2) The body has a single lump / shell&lt;BR /&gt;3) The shell / lump has a single face, whose geometry is an adsk.core.NurbsSurface instance&lt;BR /&gt;4) The face's single loop has 4 edges, whose geometries are all adsk.core.NurbsCurve3D instances&lt;/P&gt;&lt;P&gt;All of this is as I expected, although I suspect it will a little bit painful to reproduce this programmatically.&lt;/P&gt;&lt;P&gt;What I would really like to get my hands on is a complete example of how to achieve the same result programmatically, given all the required Nurbs surface info (control points, U and V control point count, U and V degress, etc.).&lt;/P&gt;&lt;P&gt;In the suggested example ( &lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a" target="_blank"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a&lt;/A&gt; ), we're almost there, but the temporary NurbsSurface / resulting body is added to the customGraphicsGroups, which is not what I want ultimately.&lt;/P&gt;&lt;P&gt;How can that body be added to the rootComponent bRepBodies collection ? I tried to use the bRepBodies.add method but that didn't work, and quite frankly I don't really understand what is missing for this to be working.&lt;/P&gt;&lt;P&gt;Thanks for any advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 13:05:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11090343#M6262</guid>
      <dc:creator>jean-marc_langlois</dc:creator>
      <dc:date>2022-04-07T13:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Nurbs surfaces in Fusion using the API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11090386#M6263</link>
      <description>&lt;P&gt;I just noticed I replied to myself, so here I go again.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;I got me in the right direction, but there still is a lot I don't really understand.&lt;/P&gt;&lt;P&gt;For testing purposes, I imported a STP file that contains a single Nurbs surface (see attached image), and I ended up with this:&lt;/P&gt;&lt;P&gt;1) A body in the rootComponent.bRepBodies collection&lt;BR /&gt;2) Te body has a single lump / shell&lt;BR /&gt;3) The shell / lump has a single face, whose geometry is an adsk.core.NurbsSurface instance&lt;BR /&gt;4) The face's single loop has 4 edges, whose geometries are all adsk.core.NurbsCurve3D instances&lt;/P&gt;&lt;P&gt;All of this is as I expected, although I suspect it will a little bit painful to reproduce this programmtically.&lt;/P&gt;&lt;P&gt;But what I would like to find is a complete example of how to achieve the same result programmatically, given all the required Nrbs surface info (control points, U and V control point count, U and V degress, etc.).&lt;/P&gt;&lt;P&gt;In the suggested example ( &lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a" target="_blank"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ca29fec6-6d94-49bb-b4cd-de77c782011a&lt;/A&gt; ), we're almost there, but the temporary NurbsSurface / resulting body is added to the customGraphicsGroups, which is not what I want ultimately.&lt;/P&gt;&lt;P&gt;How can that body be added to the rootComponent bRepBodies collection ? I tried to use th bRepBodies.add method but that didn't work, and quite frankly I don't really understand what is missing for this to be working.&lt;/P&gt;&lt;P&gt;Thansk for any advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 13:19:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11090386#M6263</guid>
      <dc:creator>jean-marc_langlois</dc:creator>
      <dc:date>2022-04-07T13:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Nurbs surfaces in Fusion using the API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11090739#M6264</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3817597"&gt;@jean-marc_langlois&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use BaseFeature for temporary brep bodies solids and surfaces and sketch for wire brep bodies.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-GUID-73BE9780-D085-42BB-85BD-92375C2DC8E3" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-GUID-73BE9780-D085-42BB-85BD-92375C2DC8E3&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you change the following near the end of the sample, you will get the result you want.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;・・・
        # # Show the temporary brep bodies
        # group = rootComp.customGraphicsGroups.add()
        # group.addBRepBody(body)
        
        # for edge in wireBrepBody.edges:
        #     group.addCurve(edge.geometry)

        # temporary brep bodies to solid or surface
        baseFeat: adsk.fusion.BaseFeature = None
        if design.designType == adsk.fusion.DesignTypes.ParametricDesignType:
            baseFeat = rootComp.features.baseFeatures.add()

        bodies: adsk.fusion.BRepBodies = rootComp.bRepBodies

        if baseFeat:
            # Parametric Design
            baseFeat.startEdit()
            try:
                bodies.add(body, baseFeat)
            except:
                pass
            finally:
                baseFeat.finishEdit()
        else:
            # Direct Design
            bodies.add(body)

        # wire brep bodies to sketch curves
        skt: adsk.fusion.Sketch = rootComp.sketches.add(
            rootComp.xYConstructionPlane
        )
        sktCrvs: adsk.fusion.SketchCurves = skt.sketchCurves
        for edge in wireBrepBody.edges:
            geo = edge.geometry
            if hasattr(geo, 'asNurbsCurve'):
                nurbs = geo.asNurbsCurve
            else:
                nurbs = geo

            sktCrvs.sketchFixedSplines.addByNurbsCurve(nurbs)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 15:03:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11090739#M6264</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-04-07T15:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Nurbs surfaces in Fusion using the API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11092964#M6265</link>
      <description>&lt;P&gt;Many thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3787950"&gt;@kandennti&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 10:56:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/nurbs-surfaces-in-fusion-using-the-api/m-p/11092964#M6265</guid>
      <dc:creator>jean-marc_langlois</dc:creator>
      <dc:date>2022-04-08T10:56:27Z</dc:date>
    </item>
  </channel>
</rss>

