<?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: Crashing when selecting BrepFace using createNewFaceContourSelection() on a setupInput Object in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13160999#M751</link>
    <description>&lt;P&gt;This also occurs with the&amp;nbsp;&lt;SPAN&gt;createNewSilhouetteSelection() method, just in case that is not mentioned in&amp;nbsp;&lt;SPAN&gt;FUS-173100&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2024 18:56:08 GMT</pubDate>
    <dc:creator>Joshua.mursic</dc:creator>
    <dc:date>2024-11-19T18:56:08Z</dc:date>
    <item>
      <title>Crashing when selecting BrepFace using createNewFaceContourSelection() on a setupInput Object</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13055624#M748</link>
      <description>&lt;P&gt;Fusion is crashing when I select BrepFaces for boundaries on the setupInput object, but not when I select a sketch object.&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;LI-CODE lang="python"&gt;import adsk.core, adsk.fusion, adsk.cam, traceback
app = adsk.core.Application.get()
ui = app.userInterface

def run(context):
    try:
        doc = app.activeDocument
        design:adsk.fusion.Design = doc.products.itemByProductType("DesignProductType")
        design.workspaces.itemById("FusionSolidEnvironment").activate()
        root = design.rootComponent
        #create new component and Brep Body
        occ = root.occurrences.addNewComponent(adsk.core.Matrix3D.create())
        s = occ.component.sketches.add(occ.component.xYConstructionPlane)
        s.sketchCurves.sketchLines.addTwoPointRectangle(adsk.core.Point3D.create(-0.5,-0.5,0),adsk.core.Point3D.create(0.5,0.5,0))
        extrudes = occ.component.features.extrudeFeatures
        exFeature = extrudes.addSimple(s.profiles.item(0),adsk.core.ValueInput.createByReal(1),adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
        body = exFeature.bodies.item(0)
        body.name = "Body"

        #activate CAM
        ui.workspaces.itemById("CAMEnvironment").activate()
        cam:adsk.cam.CAM = doc.products.itemByProductType('CAMProductType')
        
        #Get the occurence and body in CAM workspace
        cadRoot = cam.designRootOccurrence.component
        occurrence = cadRoot.occurrences.item(0)
        stockBody = occurrence.component.bRepBodies.itemByName("Body")
        #get lowest face
        stockFaces = []
        for face in stockBody.faces:
            stockFaces.append(face)
        sortedList = sorted(stockFaces,key=lambda face: face.centroid.z) #default is ascending
        lowestFace:adsk.fusion.BRepFace = sortedList[0].createForAssemblyContext(occurrence)
        
        #create a new setup
        setups = cam.setups
        setupInput = setups.createInput(adsk.cam.OperationTypes.MillingOperation)
        setupInput.stockMode = adsk.cam.SetupStockModes.SolidStock
        setupInput.stockSolids = [stockBody]
        setup = setups.add(setupInput)
        #Create a new operation
        operations = setup.operations
        operationInput = operations.createInput("pocket_clearing")
        parameters = operationInput.parameters

        #Get the boundary parameter
        parameters.itemByName("boundaryMode").value.value = 'selection'
        boundary:adsk.cam.CadContours2dParameterValue = parameters.itemByName("machiningBoundarySel").value
        curveSels: adsk.cam.CurveSelections = boundary.getCurveSelections()
        
        # WORKS - set the sketch to be the boundary
        if False:
            sel = curveSels.createNewSketchSelection()
            sel.inputGeometry = [s]
            boundary.applyCurveSelections(curveSels)

        # WORKS - set the edges of the face to be the boundary
        if False:
            sel = curveSels.createNewChainSelection()
            sel.inputGeometry = [edge for edge in lowestFace.edges]
            boundary.applyCurveSelections(curveSels)

        # CRASH - set the face to be the boundary
        if True:
            sel = curveSels.createNewFaceContourSelection()
            sel.inputGeometry = [lowestFace]
            boundary.applyCurveSelections(curveSels)

        #add the operation to the setup
        operations.add(operationInput)
        
    except:
        ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&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;</description>
      <pubDate>Tue, 01 Oct 2024 11:56:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13055624#M748</guid>
      <dc:creator>Joshua.mursic</dc:creator>
      <dc:date>2024-10-01T11:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Crashing when selecting BrepFace using createNewFaceContourSelection() on a setupInput Object</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13056959#M749</link>
      <description>&lt;P&gt;As a work around, you can select all the edges of the face and use the .&lt;SPAN&gt;createNewChainSelection() method. This works as expected.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 11:57:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13056959#M749</guid>
      <dc:creator>Joshua.mursic</dc:creator>
      <dc:date>2024-10-01T11:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Crashing when selecting BrepFace using createNewFaceContourSelection() on a setupInput Object</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13057469#M750</link>
      <description>&lt;DIV class="lia-quilt-row lia-quilt-row-header"&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-06 lia-quilt-column-right lia-quilt-column-header-right"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;
&lt;DIV class="lia-message-post-date lia-component-post-date lia-component-message-view-widget-post-date" title="Posted on"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6490295"&gt;@Joshua.mursic&lt;/a&gt;&lt;SPAN&gt;&amp;nbsp; &lt;BR /&gt;Thank you&amp;nbsp;for sharing the issue. We can reproduce the crash at our end with script provided by you , our team will analyse it further more.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="lia-quilt-row lia-quilt-row-main"&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single lia-quilt-column-main-left"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-single"&gt;
&lt;DIV id="bodyDisplay_2" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;&lt;SPAN&gt;We have logged an issue FUS-173100 for it &amp;amp; we are looking for the solution .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;BR /&gt;Sameer Babar.&lt;BR /&gt;Autodesk Fusion Team&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Oct 2024 15:09:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13057469#M750</guid>
      <dc:creator>sameer_babarNJS6C</dc:creator>
      <dc:date>2024-10-01T15:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: Crashing when selecting BrepFace using createNewFaceContourSelection() on a setupInput Object</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13160999#M751</link>
      <description>&lt;P&gt;This also occurs with the&amp;nbsp;&lt;SPAN&gt;createNewSilhouetteSelection() method, just in case that is not mentioned in&amp;nbsp;&lt;SPAN&gt;FUS-173100&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 18:56:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/crashing-when-selecting-brepface-using/m-p/13160999#M751</guid>
      <dc:creator>Joshua.mursic</dc:creator>
      <dc:date>2024-11-19T18:56:08Z</dc:date>
    </item>
  </channel>
</rss>

