Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 13, 2025

Problem

Several parts in the CNC layout SVG were positioned incorrectly, causing them to be misaligned along the Y-axis. Additionally, there was a bug in the X-positioning calculations where f11x was used instead of f11y after the part's 90-degree rotation, leading to incorrect spacing for subsequent parts.

The affected parts (d1, d6, d8, f12, f1, f2, h1, h2, h7, h8, f11, and a6) were all positioned with Y=0, causing them to align to the edge rather than being properly centered on the cutting sheet.

Solution

Modified ~CNCLAYOUT.scad to:

  1. Add Y-axis centering offsets for the 12 affected parts by using half their X-dimension as the Y-offset (e.g., d1x/2, f1x/2, h1x/2). Since these parts are rotated 90 degrees, their original X dimension becomes their Y dimension after rotation, so centering them requires offsetting by half that dimension.

  2. Fix X-positioning bug by changing f11x to f11y in the positioning calculations for parts f12, f13, f14, h1, h2, h7, and h8. After f11 is rotated 90 degrees, its height along the layout's X-axis is f11y, not f11x.

  3. Regenerated cnclayout.svg using OpenSCAD with the corrected positioning.

Results

Before:
Before - Parts misaligned along Y-axis

After:
After - Parts properly centered and aligned

Improvements:

  • ✅ Parts are now properly centered along the Y-axis
  • ✅ Reduced viewBox height from 106mm to 78mm (26% reduction)
  • ✅ Better space utilization for CNC cutting sheets
  • ✅ Fixed spacing calculation bug for parts positioned after f11
  • ✅ More compact and organized layout

Fixes positioning issues described in the issue where parts needed to be "shifted in the y" and addresses the "f11 might need to be shifted in the x" concern by fixing the dimension reference used for X-spacing calculations.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>CNC layout svg</issue_title>
<issue_description>in the cnc layout, a few parts need to be shifted in the y. d1, d6, d8, f12, f1, f2, h1, h2, h7 and h8. f11 might need to be shifted in the x. and what about a6?</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #15


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…h1, h2, h7, h8, and a6

Co-authored-by: dorkmo <1923070+dorkmo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Y and X position of parts in CNC layout SVG Fix CNC layout Y-positioning and X-spacing for parts d1, d6, d8, f1, f2, f11, f12, h1, h2, h7, h8, and a6 Oct 13, 2025
Copilot AI requested a review from dorkmo October 13, 2025 03:40
@dorkmo dorkmo marked this pull request as ready for review October 14, 2025 01:41
Copilot AI review requested due to automatic review settings October 14, 2025 01:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes positioning issues in the CNC layout SVG by correcting Y-axis centering for rotated parts and fixing X-positioning calculation errors. The changes ensure parts are properly centered on the cutting sheet rather than aligned to edges, resulting in better space utilization.

Key changes:

  • Added Y-axis centering offsets for 12 affected parts (d1, d6, d8, f12, f1, f2, h1, h2, h7, h8, f11, and a6)
  • Fixed X-positioning bug by changing f11x to f11y in positioning calculations for subsequent parts
  • Regenerated the layout SVG with corrected positioning

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dorkmo dorkmo merged commit d9e8929 into master Oct 14, 2025
4 checks passed
@dorkmo dorkmo deleted the copilot/fix-cnc-layout-svg branch October 14, 2025 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CNC layout svg

2 participants