<?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: Consistent boundaryFillInput.bRepCells.item in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/consistent-boundaryfillinput-brepcells-item/m-p/7217947#M17899</link>
    <description>&lt;P&gt;I think something like you've done is the correct answer and not just a workaround.&amp;nbsp; The order of the results shouldn't be relied upon.&amp;nbsp; You might find something consistent by controlling the order of the inputs but there's no guarantee that it would remain the same in future versions of Fusion 360.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The solution is to look for something in the results that will identify the body you want.&amp;nbsp; It could be the volume like you've done but it could also be volumes that have certain shapes, a certain number of faces, or are located in a specific area of the model.&amp;nbsp; It would differ with each specific case.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2017 21:40:44 GMT</pubDate>
    <dc:creator>ekinsb</dc:creator>
    <dc:date>2017-07-10T21:40:44Z</dc:date>
    <item>
      <title>Consistent boundaryFillInput.bRepCells.item</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/consistent-boundaryfillinput-brepcells-item/m-p/7210113#M17897</link>
      <description>&lt;P&gt;I'm hitting an issue where the&amp;nbsp;bRepCells.item on a BoundaryFill aren't consistently the same array index. The 2 Bodies used are a rectangular box and then a doing an Intersect with a cylinder to produce a rounded top. The intersect produces 3 items, but there doesn't appear to be a way to guarantee that the item index is the right one. It also appears dependent on the order of the adsk.core.ObjectCollection.create.add operations. Is there a way to consistently get the correct item?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code snippet:&lt;/P&gt;&lt;PRE&gt;    circles = sketch.sketchCurves.sketchCircles
    circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(center, 0, 0), radius)

    prof = sketch.profiles.item(0)
    distance = adsk.core.ValueInput.createByReal(length)
    extrude1 = extrudes.addSimple(prof, distance, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)

    # BoundaryFill intersect to radius the board
    tools = adsk.core.ObjectCollection.create()
    tools.add(rootComp.bRepBodies.item(0))
    tools.add(rootComp.bRepBodies.item(1))

    # Create input
    boundaryFillInput = boundaryFills.createInput(tools, adsk.fusion.FeatureOperations.IntersectFeatureOperation)

    # Specify which cell is kept
    print(boundaryFillInput.bRepCells.item(1).this)
    cell = boundaryFillInput.bRepCells.item(1)
    cell.isSelected = True

    # Create the boundary fill
    boundaryFills.add(boundaryFillInput)&lt;/PRE&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jesse&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 18:30:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/consistent-boundaryfillinput-brepcells-item/m-p/7210113#M17897</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-06T18:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Consistent boundaryFillInput.bRepCells.item</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/consistent-boundaryfillinput-brepcells-item/m-p/7214596#M17898</link>
      <description>&lt;P&gt;I kludged around it by selecting the cellBody&amp;nbsp;that's within 10% volume of the original board body.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    board_body = rootComp.bRepBodies.itemByName(board_body_name)
    board_vol = board_body.volume
    print("BOARD_BODY: ", board_body.volume)

    # Specify which cell is kept
    for x in range(0, boundaryFillInput.bRepCells.count):
        cell = boundaryFillInput.bRepCells.item(x)
        cell_vol = cell.cellBody.volume
        orig_percent = (cell_vol / board_vol) * 100
        print("Cell{0}: {1}\t{2} %".format(x, cell_vol, orig_percent))
        if 90 &amp;lt;= orig_percent &amp;lt;= 100:
            cell.isSelected = True
            break&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2017 19:04:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/consistent-boundaryfillinput-brepcells-item/m-p/7214596#M17898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-08T19:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Consistent boundaryFillInput.bRepCells.item</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/consistent-boundaryfillinput-brepcells-item/m-p/7217947#M17899</link>
      <description>&lt;P&gt;I think something like you've done is the correct answer and not just a workaround.&amp;nbsp; The order of the results shouldn't be relied upon.&amp;nbsp; You might find something consistent by controlling the order of the inputs but there's no guarantee that it would remain the same in future versions of Fusion 360.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The solution is to look for something in the results that will identify the body you want.&amp;nbsp; It could be the volume like you've done but it could also be volumes that have certain shapes, a certain number of faces, or are located in a specific area of the model.&amp;nbsp; It would differ with each specific case.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 21:40:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/consistent-boundaryfillinput-brepcells-item/m-p/7217947#M17899</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2017-07-10T21:40:44Z</dc:date>
    </item>
  </channel>
</rss>

