{"id":17255321,"url":"https://github.com/crozone/openscad-trotec-export","last_synced_at":"2026-02-03T12:07:44.389Z","repository":{"id":88314214,"uuid":"483576863","full_name":"crozone/openscad-trotec-export","owner":"crozone","description":"Powershell script for exporting 2D OpenSCAD models to a Trotec laser compatible PDF.","archived":false,"fork":false,"pushed_at":"2022-04-22T00:55:22.000Z","size":16,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T09:43:38.066Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crozone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-04-20T08:48:24.000Z","updated_at":"2023-02-24T21:19:39.000Z","dependencies_parsed_at":"2023-03-13T18:25:18.856Z","dependency_job_id":null,"html_url":"https://github.com/crozone/openscad-trotec-export","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/crozone/openscad-trotec-export","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crozone%2Fopenscad-trotec-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crozone%2Fopenscad-trotec-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crozone%2Fopenscad-trotec-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crozone%2Fopenscad-trotec-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crozone","download_url":"https://codeload.github.com/crozone/openscad-trotec-export/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crozone%2Fopenscad-trotec-export/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29045459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T10:09:22.136Z","status":"ssl_error","status_checked_at":"2026-02-03T10:09:16.814Z","response_time":96,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-15T07:11:18.416Z","updated_at":"2026-02-03T12:07:44.369Z","avatar_url":"https://github.com/crozone.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openscad-trotec-export\nPowershell script for exporting 2D OpenSCAD models to a Trotec laser compatible PDF.\n\n## Preface\n\nCreating Trotec compatible PDFs from OpenSCAD usually requires a tedious manual export process. A \"cut\" and an \"engrave\" SVG need to be exported from OpenSCAD, then imported into software such as Inkscape, where the paths can be manually aligned, have their stroke and fill adjusted to match the required colour and thickness needed by the Trotec software, and then finally saved as PDF.\n\nThis script automates this process. It takes a .scad file and exports both a combined .SVG and .PDF which can be used with Trotec laser software immediately.\n\n### Trotec compatible PDFs\n\nTo be compatible with Trotec software defaults, the script uses the following parameters for the cut and engrave paths:\n\n* **Cut paths:** Red, 100% opacity (RGBA #FF0000FF), with 0.01mm thickness stroke. No infill.\n\n* **Engrave paths:** No stroke. Black infill, 100% opacity (RGBA #000000FF).\n\nOther colours can be configured in the Trotec software to indicate different cut/engrave settings, however these are currently not supported by this script.\nIt should be simple to modify the script to add additional layers with additional output settings as required.\n\n## Dependencies\n\n* Powershell (Only tested on Powershell 5.1 for Windows, but [Powershell Core](https://github.com/PowerShell/PowerShell) should work on Linux and MacOS)\n* OpenSCAD (.scad -\u003e .svg)\n* Inkscape (.svg -\u003e .pdf)\n\n\nThe script will search for OpenSCAD and Inkscape using a list of pre-defined install locations. Common paths for Windows, Linux, and MacOS are included. If your OpenSCAD or Inkscape is installed in an unusual location, set the `OPENSCAD_LOCATION` and/or `INKSCAPE_LOCATION` environment variables to the paths of the application executables.\n\nFor example:\n\n```PowerShell\n$Env:OPENSCAD_LOCATION = \"C:\\OpenSCAD\\openscad.exe\"\n$Env:INKSCAPE_LOCATION = \"C:\\Inkscape\\bin\\inkscape.exe\"\n```\n\n## Usage\n\n`openscad_export_for_trotec.ps1 \u003cinput_scad_path\u003e`\n\n## Example\n\n`./openscad_export_for_trotec.ps1 ./examples/basic/basic.scad`\n\n`basic_trotec.svg` and `basic_trotec.pdf` will be created in the same directory as `basic.scad`.\n\n## Making your .scad files compatible\n\nThe script sets the constant `EXPORT_LAYER` depending on whether the \"cut\" layer or the \"engrave\" layer are to be exported:\n\n* Cut: `EXPORT_LAYER=1`\n* Engrave: `EXPORT_LAYER=2`\n\nYour .scad file should include the line `EXPORT_LAYER = 0;` in the top-most scope. This will then be overridden during export. Your .scad can then be set up to output the approprate geometry based on the value of `EXPORT_LAYER`.\n\nFor example:\n\n```OpenSCAD\nEXPORT_LAYER = 0;\n\nmodule part() {\n    // Cut geometry goes here\n}\n\nmodule engrave() {\n    // Engrave geometry goes here\n}\n\nif(EXPORT_LAYER == 1) {\n    // Cut layer\n    part();\n}\nelse if(EXPORT_LAYER == 2) {\n    // Engrave layer\n    engrave();\n}\nelse {\n    // Normal mode / preview\n    part();\n    %engrave();\n}\n```\n\nSee [examples](examples/) for examples.\n\n## Script steps\nThe steps the script takes are:\n\n1. Export input .scad to SVG data with `EXPORT_LAYER=1` to generate cut geometry.\nThis is piped into an internal variable and there is no intermediate SVG file.\n2. Export input .scad to SVG data with `EXPORT_LAYER=2` to generate engrave geometry.\nThis is piped into an internal variable and there is no intermediate SVG file.\n3. Modify the attributes of the cut and engrave SVGs to set path stroke and fill, as well as document title.\nAll SVG manipulation is handled internally by Powershell's .NET XML libraries.\n4. Combine the cut and engrave SVGs by inserting the engrave path into the cut SVG.\n5. Save combined SVG data to file (`_trotec.svg`).\n6. Call Inkscape to convert SVG to PDF (`_trotec.svg`) -\u003e (`_trotec.pdf`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrozone%2Fopenscad-trotec-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrozone%2Fopenscad-trotec-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrozone%2Fopenscad-trotec-export/lists"}