<?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: Cutting QR Code - Stuck in Floating Point Hell 😩 in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679567#M21886</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12364171"&gt;@Jorge_Jaramillo&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Here's how I add the newly drawn profiles and cut them from the surface:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;  # Draw rectangle in nested for loop with addTwoPointRectangle() above

  profiles = adsk.core.ObjectCollection.create()

  # Add profiles to collection start at 1 as first profile is always the sketch face
  for i in range(1, sketch.profiles.count):
      profiles.add(sketch.profiles.item(i))

  # Extrude cut using the profile collection
  extrude_input = design.activeComponent.features.extrudeFeatures.createInput(profiles, adsk.fusion.FeatureOperations.CutFeatureOperation)
  depth_value = adsk.core.ValueInput.createByString(f'-{depth} cm')
  extrude_input.setDistanceExtent(False, depth_value)
  design.activeComponent.features.extrudeFeatures.add(extrude_input)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12364171"&gt;@Jorge_Jaramillo&lt;/a&gt;&amp;nbsp;Let me know if you have any questions or need anything else.&lt;BR /&gt;&lt;BR /&gt;Scott&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jun 2025 00:40:05 GMT</pubDate>
    <dc:creator>scott58PC2</dc:creator>
    <dc:date>2025-06-13T00:40:05Z</dc:date>
    <item>
      <title>Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13652607#M21831</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hey all,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I’m a long time software engineer and a fairly recent Fusion 360 user (it’s been about 2.5 years). I mostly use Fusion 360 to create various models and designs for the 3D printing company I work for.&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;We’re trying to automate a number of manual processes with scripts/add-ins. I’ve been tasked with creating an add-in that can stamp any face with a qr code of varying side length. I started by looking at &lt;/SPAN&gt;&lt;A href="https://github.com/tapnair/QRCoder" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;Patrick Rainsberry’s (tapnair) QRCoder git repository&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt; and then settled on my own solution.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I decided to create an add-in that allowed a user to select a face, the depth of the QR code (cut depth) and the size, then would stamp the face with a generated qr code by cutting the white pixels out of the face and leaving the black pixels raised.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This was fairly straight forward. I pulled in the qrcode dependency via &lt;/SPAN&gt;&lt;STRONG&gt;pip3 install qrcode --target /project/path&lt;/STRONG&gt;&lt;SPAN&gt; to the project to get the &lt;/SPAN&gt;&lt;STRONG&gt;QRCode&lt;/STRONG&gt;&lt;SPAN&gt; object and filled out the &lt;/SPAN&gt;&lt;STRONG&gt;command_execute()&lt;/STRONG&gt;&lt;SPAN&gt; method in the &lt;/SPAN&gt;&lt;STRONG&gt;commandDialog’s&lt;/STRONG&gt; &lt;STRONG&gt;entry.py&lt;/STRONG&gt;&lt;SPAN&gt; class.&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;At a high level my logic to stamp the QR Code is as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;Use the qr code side length to calculate start X and Y and the individual pixel size.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Convert the QRCode to a matrix and loop through the matrix identifying each white pixel.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;When a white pixel is found, calculate the coordinates needed for the 2 points to draw the pixel.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Draw a pixel with the two points and the &lt;/SPAN&gt;&lt;STRONG&gt;addTwoPointRectangle() &lt;/STRONG&gt;&lt;SPAN&gt;method.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;After all white pixels have been drawn, loop through the sketch profiles and add them to an object collection.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Use the object collection to extrude (cut) the white pixels the depth determined by the user.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;At first I thought this was a complete failure as this produced a feature that looked nothing like a qr code, but I quickly realized there wasn’t really any reason this should fail. After a couple of hours of debugging I realized the problem was floating point arithmetic. I had entered floating point hell.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I came to this realization when I added a tiny gap between each pixel and the code looked perfect (minus the gaps). See the image below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2025-05-23 at 8.09.27 PM.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1537831i60C6F6B083B357C7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2025-05-23 at 8.09.27 PM.png" alt="Screenshot 2025-05-23 at 8.09.27 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I then removed the gap and diagnosed further. I tried filtering out the smaller profiles and rounding certain calculations. It got me closer to a valid qr code but still nothing that would scan or resemble the code with gaps. This approach however, solidified my suspicion that floating point arithmetic was to blame as I had multiple examples where I’d get qr codes with tiny connected regions and/or features of the qr code that were merged into a single region. See the below photo for an example:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2025-05-23 at 8.06.55 PM.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1537832iB48D5B4BA53966E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2025-05-23 at 8.06.55 PM.png" alt="Screenshot 2025-05-23 at 8.06.55 PM.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;Below are the floating point calculations happening when looping through the matrix:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;pixel_size = side_length / qr_code_size
&amp;nbsp; &amp;nbsp;start_x = center.x - (side_length / 2) # center is the center point of the selected face

&amp;nbsp;&amp;nbsp;&amp;nbsp;start_y = center.y - (side_length / 2)

&amp;nbsp;&amp;nbsp;&amp;nbsp;# loop through the col and row of the qr code matrix
&amp;nbsp;&amp;nbsp;&amp;nbsp;# if there’s a white pixel calculate two points and add to the sketch

&amp;nbsp;&amp;nbsp;&amp;nbsp;x0 = start_x + col * pixel_size
&amp;nbsp;&amp;nbsp;&amp;nbsp;y0 = start_y + row * pixel_size

&amp;nbsp;&amp;nbsp;&amp;nbsp;x1 = x0 + pixel_size
&amp;nbsp;&amp;nbsp;&amp;nbsp;y1 = y0 + pixel_size

&amp;nbsp;&amp;nbsp;&amp;nbsp;pt1 = adsk.core.Point3D.create(x0, y0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;pt2 = adsk.core.Point3D.create(x1, y1)
   sketch.sketchCurves.sketchLines.addTwoPointRectangle(pt1, pt2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can’t seem to get the precision/rounding of the floating point numbers just right. I’ve tried rounding, flooring the number and even using Python’s Decimal object. I understand why this is happening (floating point hell, a common problem in computing) but I can’t seem to eliminate the creation of extra sketch profiles created from precision errors. I’m working in millimeters and the side_length and qr_code_size are variable due to user input. Please can someone help me get out of floating point hell!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 01:44:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13652607#M21831</guid>
      <dc:creator>scott58PC2</dc:creator>
      <dc:date>2025-05-28T01:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13664869#M21853</link>
      <description>&lt;P&gt;I don't think this is a floating-point issue. I know there can be issues with floating-point numbers, but I don't believe that should come into play with what you're doing because floating-point math is many orders of magnitude more precise than the precision Fusion uses when determining if two points are equal. I just saw what looks like a bug in this area the other day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you create the profile and then manually select the different profiles to create the extrusion, do you still see the problem? If so, can you post the f3d here for the developers to look at? If you only see the problem when using the API to create the extrusion, there's a possibility there's a bug somewhere in the API pipeline to create the extrusion.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 06:48:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13664869#M21853</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2025-06-04T06:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13665964#M21854</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe your problem is caused by creating SketchPoint's which are too close to each other.&lt;/P&gt;&lt;P&gt;In a previous development I made, I just looked for a previous created SketchPoint in the Sketch which is at a maximum distance (tolerance) before creating any new SketchPoint.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, you can use the &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;SketchPoint.geometry.isEqualToByTolerance(newPoint, MAX_TOLERANCE)&lt;/STRONG&gt;&lt;/FONT&gt; to check if other point is "equal" to the one you need to be created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;EM&gt;Please note:&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;isEqualToByTolerance &lt;/STRONG&gt;method checks to see if this point and another point are equal within the specified tolerance&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MAX_TOLERANCE&lt;/STRONG&gt; =&amp;nbsp;1e-6&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;newPoint&lt;/STRONG&gt; : Point3D = Point3D(x0, y0)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SketchPoint&lt;/STRONG&gt; is taken inside a loop over Sketch.sketchPoints collection from the Sketch your code is working on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is link to the Fusion's API reference for the isEqualToByTolerance method:&amp;nbsp;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-3CCAD4A1-0008-483C-88D1-0B30774C0A2B" target="_blank"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-3CCAD4A1-0008-483C-88D1-0B30774C0A2B&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to my experience, I'd suggest to work with tolerances when working with floating point numbers when checking for "equality".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this could help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Jorge Jaramillo&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 15:30:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13665964#M21854</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2025-06-04T15:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13673529#M21878</link>
      <description>&lt;P&gt;Hey&amp;nbsp;Jorge,&lt;BR /&gt;&lt;BR /&gt;I've seen a couple things on my end since my first post that suggest that this might not be a floating point issue as well. I'm interested in using &lt;STRONG&gt;SketchPoint.geometry.isEqualToByTolerance(newPoint, MAX_TOLERANCE)&lt;/STRONG&gt;&amp;nbsp;with my current solution.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12364171"&gt;@Jorge_Jaramillo&lt;/a&gt;&amp;nbsp;Just to clarify. The solution you're suggesting is that before I create the new points to create the profile via&amp;nbsp;&lt;STRONG&gt;addTwoPointRectangle(pt1, pt2)&lt;/STRONG&gt; I should loop through all of the previous points inside of the&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;Sketch.sketchPoints collection&lt;/SPAN&gt;&lt;/STRONG&gt; and use&amp;nbsp;&lt;STRONG&gt;SketchPoint.geometry.isEqualToByTolerance(newPoint, MAX_TOLERANCE)&lt;/STRONG&gt; to check if there are any pre-existing points that are equal. If they &lt;STRONG&gt;are equal&lt;/STRONG&gt; I return and reuse the previous points, if they are&amp;nbsp;&lt;STRONG&gt;not equal&lt;/STRONG&gt; I use the newly created points. Is this accurate, let me know please?&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5741855"&gt;@BrianEkins&lt;/a&gt;&amp;nbsp;I'm going to try Jorge's approach. If this is the issue I'll let you know, if this still seems to be bug I'll post the .&lt;SPAN&gt;f3d for the devs to take a look.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Thanks both for the help!&lt;BR /&gt;&lt;BR /&gt;Scott&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 22:38:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13673529#M21878</guid>
      <dc:creator>scott58PC2</dc:creator>
      <dc:date>2025-06-09T22:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13673542#M21879</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/17390865"&gt;@scott58PC2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes. What you described is what I meant.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this could help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge Jaramillo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 22:51:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13673542#M21879</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2025-06-09T22:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13677789#M21882</link>
      <description>&lt;P&gt;Hey Guys,&lt;BR /&gt;&lt;BR /&gt;I've added a&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;generate_point_with_tolerance&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sketch&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;adsk&lt;/SPAN&gt;&lt;SPAN&gt;.fusion.Sketch, &lt;/SPAN&gt;&lt;SPAN&gt;newPoint&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;adsk&lt;/SPAN&gt;&lt;SPAN&gt;.core.Point3D) -&amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;adsk&lt;/SPAN&gt;&lt;SPAN&gt;.core.Point3D&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;method to my code that checks to see if there exists a point within the &lt;STRONG&gt;1e-6&amp;nbsp;&lt;/STRONG&gt;tolerance. If it exists, the method returns the point inside the tolerance instead of the new point. Below is my code that utilizes the new tolerance method:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;   pixel_size = side_length / qr_code_size
   start_x = center.x - (side_length / 2) # center is the center point of the selected face

   start_y = center.y - (side_length / 2)

   # loop through the col and row of the qr code matrix
   # if there’s a white pixel calculate two points and add to the sketch

   for row in range(qr_code_size):
    for col in range(qr_code_size):
        if not qr_code_matrix[row][col]:
           x0 = start_x + col * pixel_size
           y0 = start_y + row * pixel_size

           x1 = x0 + pixel_size
           y1 = y0 + pixel_size

           pt1 = adsk.core.Point3D.create(x0, y0)
           pt2 = adsk.core.Point3D.create(x1, y1)

           pt1_tolerance = __generate_point_with_tolerance(sketch, pt1)
           pt2_tolerance = __generate_point_with_tolerance(sketch, pt2)
           
           sketch.sketchCurves.sketchLines.addTwoPointRectangle(pt1_tolerance, pt2_tolerance)

    # generate_point_with_tolerance method definition
    def __generate_point_with_tolerance(sketch: adsk.fusion.Sketch, newPoint: adsk.core.Point3D) -&amp;gt; adsk.core.Point3D:
        tolerance = 1e-6

        for point in sketch.sketchPoints:
            if point.geometry.isEqualToByTolerance(newPoint, tolerance):
                return point

        return newPoint&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;This didn't seem to fix the issue.&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12364171"&gt;@Jorge_Jaramillo&lt;/a&gt;&amp;nbsp;do you see anything wrong with my implementation? I tried returning the point a few different ways as I was worried I was over looking or unaware of how Python manages custom objects under the hood but they all produced the same result which was essentially the exact same as the previous implementation. Am I missing something here?&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5741855"&gt;@BrianEkins&lt;/a&gt;&amp;nbsp;Unless I've overlooked something fairly major in my above approach I'm starting to think this might be a bug as you first suggested. I stepped through each row iteration and looked at how the QR Code is being drawn row by row. I found a few interesting things. The first few iterations seem to be fine (rows 0 - 5). I've attached a photo of the first few iterations.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2025-06-10 at 12.43.10 AM.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1542758i0C49E3E12095B006/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2025-06-10 at 12.43.10 AM.png" alt="Screenshot 2025-06-10 at 12.43.10 AM.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;The next iteration (row 0 - 6) seems to break the QR Code and is where I start to see profiles being unintentionally added. Below is an image of the QR code at row iteration 6:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2025-06-10 at 12.40.06 AM.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1542759i30B6216960EC9241/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2025-06-10 at 12.40.06 AM.png" alt="Screenshot 2025-06-10 at 12.40.06 AM.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;You can see that once I start drawing regions of the sketch that encircle or surround other features of the QR code, ADSK groups the profiles together effectively removing that part of the QR code.&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5741855"&gt;@BrianEkins&lt;/a&gt;&amp;nbsp;Is this expected behaviour or some sort of optimization I can toggle on or off? Or do you think this could be a bug? If it's a bug can we discuss how I can help the development team resolve this? Let me know.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Scott&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 04:02:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13677789#M21882</guid>
      <dc:creator>scott58PC2</dc:creator>
      <dc:date>2025-06-12T04:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679062#M21883</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can you share the piece of the code you use to select and cut the "white" profiles?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 15:29:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679062#M21883</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2025-06-12T15:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679567#M21886</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12364171"&gt;@Jorge_Jaramillo&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Here's how I add the newly drawn profiles and cut them from the surface:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;  # Draw rectangle in nested for loop with addTwoPointRectangle() above

  profiles = adsk.core.ObjectCollection.create()

  # Add profiles to collection start at 1 as first profile is always the sketch face
  for i in range(1, sketch.profiles.count):
      profiles.add(sketch.profiles.item(i))

  # Extrude cut using the profile collection
  extrude_input = design.activeComponent.features.extrudeFeatures.createInput(profiles, adsk.fusion.FeatureOperations.CutFeatureOperation)
  depth_value = adsk.core.ValueInput.createByString(f'-{depth} cm')
  extrude_input.setDistanceExtent(False, depth_value)
  design.activeComponent.features.extrudeFeatures.add(extrude_input)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12364171"&gt;@Jorge_Jaramillo&lt;/a&gt;&amp;nbsp;Let me know if you have any questions or need anything else.&lt;BR /&gt;&lt;BR /&gt;Scott&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 00:40:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679567#M21886</guid>
      <dc:creator>scott58PC2</dc:creator>
      <dc:date>2025-06-13T00:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679719#M21887</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe that you have to filter just the profiles that represent a "white pixel".&lt;/P&gt;&lt;P&gt;It happens that when there is an area surrounded completed by a set of profiles, that area becomes a profile itself, like the blue area in the image below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jorge_Jaramillo_0-1749787337038.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1543140i8CEBDBC9C3627EC1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jorge_Jaramillo_0-1749787337038.png" alt="Jorge_Jaramillo_0-1749787337038.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to select the profiles that represent a "white pixel" inside&amp;nbsp; the for loop.&lt;/P&gt;&lt;P&gt;Does it make sense to you?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge Jaramillo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 04:09:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679719#M21887</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2025-06-13T04:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679793#M21888</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12364171"&gt;@Jorge_Jaramillo&lt;/a&gt;&amp;nbsp;I see what you're saying. Off the top of your head do you know if an easy way to filter these? I tried using area but that was not effective. Thoughts?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 05:35:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13679793#M21888</guid>
      <dc:creator>scott58PC2</dc:creator>
      <dc:date>2025-06-13T05:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cutting QR Code - Stuck in Floating Point Hell 😩</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13680671#M21892</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/17390865"&gt;@scott58PC2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd change the algorithm for something like this:&lt;/P&gt;&lt;P&gt;- Make a grid with "N+1" vertical lines and "N+1" horizontal lines; this will make a profile grid NxN with a profile for each pixel in the QRcode.&lt;/P&gt;&lt;P&gt;- Iterate over the lines in the QR's matrix:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;- Iterate over each cell in the line:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; - If it's a white pixel, look for the equivalent profile in the grid, and add it (the profile) to the profile collection&lt;/P&gt;&lt;P&gt;- Make the extrude with the profile collection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way you certainly extrude the right profiles, no matter of the size or position (inner, outer) of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please note:&lt;/STRONG&gt;&amp;nbsp;the way you are building the QRcode in the XY plane, it will be flipped vertically; some readers won't read it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge Jaramillo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 13:51:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cutting-qr-code-stuck-in-floating-point-hell/m-p/13680671#M21892</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2025-06-13T13:51:50Z</dc:date>
    </item>
  </channel>
</rss>

