{"id":22729228,"url":"https://github.com/ryanlarge13/nc-pivot-er","last_synced_at":"2025-03-30T00:43:51.957Z","repository":{"id":265644663,"uuid":"852425792","full_name":"RyanLarge13/NC-Pivot-Er","owner":"RyanLarge13","description":"A small desktop widget for NC file editing and generation","archived":false,"fork":false,"pushed_at":"2024-12-10T18:03:48.000Z","size":247,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T18:00:01.400Z","etag":null,"topics":["electronjs","fs","nodejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RyanLarge13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-04T19:30:53.000Z","updated_at":"2024-12-10T18:03:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"c6ba4365-39b4-45f8-b8be-75b0d1087c2a","html_url":"https://github.com/RyanLarge13/NC-Pivot-Er","commit_stats":null,"previous_names":["ryanlarge13/nc-pivot-er"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanLarge13%2FNC-Pivot-Er","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanLarge13%2FNC-Pivot-Er/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanLarge13%2FNC-Pivot-Er/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanLarge13%2FNC-Pivot-Er/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyanLarge13","download_url":"https://codeload.github.com/RyanLarge13/NC-Pivot-Er/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246262491,"owners_count":20749171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electronjs","fs","nodejs"],"created_at":"2024-12-10T18:09:00.002Z","updated_at":"2025-03-30T00:43:51.930Z","avatar_url":"https://github.com/RyanLarge13.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nc-pivitor\n\nAn Electron application with React and TypeScript\n\n## Recommended IDE Setup\n\n- [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)\n\n## Project Setup\n\n### Install\n\n```bash\n$ npm install\n```\n\n### Development\n\n```bash\n$ npm run dev\n```\n\n### Build\n\n```bash\n# For windows\n$ npm run build:win\n\n# For macOS\n$ npm run build:mac\n\n# For Linux\n$ npm run build:linux\n```\n\nPossible formula for generating new coordinates based on pivot distances for 5Axis tool paths\n\n```\nX_new = X_old + ((X_old / Pivot_old) * (Pivot_new - Pivot_old))\nY_new = Y_old + ((Y_old / Pivot_old) * (Pivot_new - Pivot_old))\nZ_new = Z_old + ((Z_old / Pivot_old) * (Pivot_new - Pivot_old))\n```\n\n```\nX_new = -5.2182 + ((-5.2182 / 12.9075) * (12.8708 - 12.9075))\n      = -5.2182 + ((-5.2182 / 12.9075) * -0.0367)\n      = -5.2182 + (-0.01479)\n      ≈ -5.205\n\nY_new = -2.6078 + ((-2.6078 / 12.9075) * -0.0367)\n      = -2.6078 + (-0.00741)\n      ≈ -2.6157\n\nZ_new = 12.4039 + ((12.4039 / 12.9075) * -0.0367)\n      = 12.4039 + (0.00343)\n      ≈ 12.4073\n```\n\nExample\n\n```\nconst fs = require('fs');\n\n// Function to calculate new coordinates based on pivot distance\nfunction calculateNewCoordinates(X_old, Y_old, Z_old, Pivot_old, Pivot_new) {\n    const X_new = X_old + ((X_old / Pivot_old) * (Pivot_new - Pivot_old));\n    const Y_new = Y_old + ((Y_old / Pivot_old) * (Pivot_new - Pivot_old));\n    const Z_new = Z_old + ((Z_old / Pivot_old) * (Pivot_new - Pivot_old));\n\n    return { X_new, Y_new, Z_new };\n}\n\n// Example coordinates (from the file with pivot distance 12.9075)\nconst coordinates = {\n    X: -5.1933,\n    Y: -2.5985,\n    Z: 12.3646\n};\nconst Pivot_old = 12.9075;\nconst newPivotDistances = [12.8708, 12.7900];\n\n// Generate new files with updated coordinates\nnewPivotDistances.forEach(Pivot_new =\u003e {\n    const { X_new, Y_new, Z_new } = calculateNewCoordinates(\n        coordinates.X, coordinates.Y, coordinates.Z, Pivot_old, Pivot_new\n    );\n\n    // Format the new G-code line\n    const gcodeLine = `G01 X${X_new.toFixed(4)} Y${Y_new.toFixed(4)} Z${Z_new.toFixed(4)}\\n`;\n\n    // Write the new G-code to a file (you can replace this with actual file read/write)\n    fs.writeFileSync(`output_${Pivot_new}.nc`, gcodeLine);\n    console.log(`Generated G-code for pivot ${Pivot_new}: ${gcodeLine}`);\n});\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanlarge13%2Fnc-pivot-er","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanlarge13%2Fnc-pivot-er","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanlarge13%2Fnc-pivot-er/lists"}