<?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 BUG in mirroring features? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-in-mirroring-features/m-p/8604288#M14611</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/226105"&gt;@jeff_strater&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I get someone in AD to take the issue of hole features seriously?&amp;nbsp; I've reported similar issues with creating hole features several times before but nothing has been done about it.&amp;nbsp;&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-support/another-bug-with-hole-creation/td-p/8190531" target="_blank" rel="noopener"&gt;bug reported here&lt;/A&gt;;&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/4-bugs-at-least-related-to-occurrences/td-p/8105766" target="_blank" rel="noopener"&gt;other bugs reported here&lt;/A&gt;,&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/api-hole-setpositionbyplaneandoffsets-bug/td-p/7673479" target="_blank" rel="noopener"&gt;and here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is clear, at least to me, that the process of mirroring a component is flawed, and severely flawed when it comes to holes features.&amp;nbsp; To demonstrate - I've created a simple script that adds a hole to a simple box component (just to make the script easier, I've limited the hole creation to a face that has 8 edges - ie one with a square hole in it).&amp;nbsp; The holes are supposed to be created at face.pointInFace.&amp;nbsp; In the attached screen cast you can see that holes in a normal component are created correctly, however holes created in the mirrored box actually end up on the wrong side of the mirroring plane.&amp;nbsp; This implies that the mirroring process does not mirror everything, and clearly leaves some internal coordinate aspects in the unmirrored state.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not only is this a huge problem for me, but I strongly suspect that it is a source of model instability and unexplained crashes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="screencast_placeholder"&gt;Screencast will be displayed here after you click Post.&lt;/DIV&gt;
&lt;DIV class="screencast_placeholder"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To use the script - click on any vertex on a face with a hole in it.&amp;nbsp; A file with the model is attached.&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV class="screencast_placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="screencast_placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="screencast_placeholder"&gt;
&lt;P class="screencast_id"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="screencast_id"&gt;025e680f-c633-49ff-a7e7-77483bc36a5a&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;import adsk.core, adsk.fusion, traceback

def run(context):
  ui = None
  try:
    app = adsk.core.Application.get()
    ui  = app.userInterface
    
    design = adsk.fusion.Design.cast(app.activeProduct)
    root = design.rootComponent
    
    def createHole(face:adsk.fusion.BRepFace, vertex):
        component = adsk.fusion.Component.cast(face.assemblyContext.component)
        occurrence = root.allOccurrencesByComponent(component).item(0) #make top/first occurrence 
#        Hole feature doesn't work consistently for any other occurrence except :1
        face = face.nativeObject.createForAssemblyContext(occurrence)
        vertex = vertex.nativeObject.createForAssemblyContext(occurrence)
         
        holes =  component.features.holeFeatures
        holeInput = holes.createSimpleInput(adsk.core.ValueInput.createByReal(.5*2.54))
        holeInput.isDefaultDirection = True
        holeInput.creationOccurrence = occurrence
        holeInput.tipAngle = adsk.core.ValueInput.createByString('180 deg')
        holeInput.participantBodies = [face.body]
        holeInput.setPositionByPoint(face, face.pointOnFace)

        holeInput.setDistanceExtent(adsk.core.ValueInput.createByReal(.1))

        return holes.add(holeInput)
        
 
    vertexSelection = ui.selectEntity('select a vertex', 'Vertices')
    vertex = vertexSelection.entity   
    for face in vertex.faces:
        if face.edges.count != 8:
            continue
        startFace = face
            
    occurrence = startFace.body.assemblyContext
    
    hole = createHole(startFace, vertex)

  except:
    if ui:
      ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Feb 2019 02:11:58 GMT</pubDate>
    <dc:creator>pludikar</dc:creator>
    <dc:date>2019-02-19T02:11:58Z</dc:date>
    <item>
      <title>BUG in mirroring features?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-in-mirroring-features/m-p/8604288#M14611</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/226105"&gt;@jeff_strater&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I get someone in AD to take the issue of hole features seriously?&amp;nbsp; I've reported similar issues with creating hole features several times before but nothing has been done about it.&amp;nbsp;&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-support/another-bug-with-hole-creation/td-p/8190531" target="_blank" rel="noopener"&gt;bug reported here&lt;/A&gt;;&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/4-bugs-at-least-related-to-occurrences/td-p/8105766" target="_blank" rel="noopener"&gt;other bugs reported here&lt;/A&gt;,&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/api-hole-setpositionbyplaneandoffsets-bug/td-p/7673479" target="_blank" rel="noopener"&gt;and here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is clear, at least to me, that the process of mirroring a component is flawed, and severely flawed when it comes to holes features.&amp;nbsp; To demonstrate - I've created a simple script that adds a hole to a simple box component (just to make the script easier, I've limited the hole creation to a face that has 8 edges - ie one with a square hole in it).&amp;nbsp; The holes are supposed to be created at face.pointInFace.&amp;nbsp; In the attached screen cast you can see that holes in a normal component are created correctly, however holes created in the mirrored box actually end up on the wrong side of the mirroring plane.&amp;nbsp; This implies that the mirroring process does not mirror everything, and clearly leaves some internal coordinate aspects in the unmirrored state.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not only is this a huge problem for me, but I strongly suspect that it is a source of model instability and unexplained crashes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="screencast_placeholder"&gt;Screencast will be displayed here after you click Post.&lt;/DIV&gt;
&lt;DIV class="screencast_placeholder"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To use the script - click on any vertex on a face with a hole in it.&amp;nbsp; A file with the model is attached.&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV class="screencast_placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="screencast_placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="screencast_placeholder"&gt;
&lt;P class="screencast_id"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="screencast_id"&gt;025e680f-c633-49ff-a7e7-77483bc36a5a&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;import adsk.core, adsk.fusion, traceback

def run(context):
  ui = None
  try:
    app = adsk.core.Application.get()
    ui  = app.userInterface
    
    design = adsk.fusion.Design.cast(app.activeProduct)
    root = design.rootComponent
    
    def createHole(face:adsk.fusion.BRepFace, vertex):
        component = adsk.fusion.Component.cast(face.assemblyContext.component)
        occurrence = root.allOccurrencesByComponent(component).item(0) #make top/first occurrence 
#        Hole feature doesn't work consistently for any other occurrence except :1
        face = face.nativeObject.createForAssemblyContext(occurrence)
        vertex = vertex.nativeObject.createForAssemblyContext(occurrence)
         
        holes =  component.features.holeFeatures
        holeInput = holes.createSimpleInput(adsk.core.ValueInput.createByReal(.5*2.54))
        holeInput.isDefaultDirection = True
        holeInput.creationOccurrence = occurrence
        holeInput.tipAngle = adsk.core.ValueInput.createByString('180 deg')
        holeInput.participantBodies = [face.body]
        holeInput.setPositionByPoint(face, face.pointOnFace)

        holeInput.setDistanceExtent(adsk.core.ValueInput.createByReal(.1))

        return holes.add(holeInput)
        
 
    vertexSelection = ui.selectEntity('select a vertex', 'Vertices')
    vertex = vertexSelection.entity   
    for face in vertex.faces:
        if face.edges.count != 8:
            continue
        startFace = face
            
    occurrence = startFace.body.assemblyContext
    
    hole = createHole(startFace, vertex)

  except:
    if ui:
      ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2019 02:11:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/bug-in-mirroring-features/m-p/8604288#M14611</guid>
      <dc:creator>pludikar</dc:creator>
      <dc:date>2019-02-19T02:11:58Z</dc:date>
    </item>
  </channel>
</rss>

