-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Add GCodeExporter and external example for Polyslice G-code slicer #32502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Add GCodeExporter and external example for Polyslice G-code slicer #32502
Conversation
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
…anges Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
|
You did this with Copilot, right? As a scaffold it's okay but a lot of fine-tuning is missing. |
|
@Mugen87 yeah i'm working primarily with Copilot, its so much faster, and you can fine-tune the details manually. I will make a few adjustments based off your comments and update you again in 24 ish hours. Regarding the scale, I have been using a conversion rate of 1 unit in three.js = 1mm. This rate seems to be be consistent with the STL and OBJ exporters. If I create a geometry like |
|
BTW: Tested a round-trip with |
Updates:@Mugen87 I have made several updates in response to your comments (9f0dc81) as well as a few additional changes:
Notes:With regard to the multiple instances warning, I think this is because the Polyslice browser bundle comes with three.js included. Not sure what the best solution should be here ... perhaps I update Polyslice to have two different browser bundles, one with three.js included and one without? A further note with regard to the scaling issue you mentioned yesterday. Polyslice also comes with config options for using different units of measurement. If you have something you designed in meters or just prefer working in that scale you can add I'm glad the round trip between the exporter and loader is working! I could add a lot more functionality to this example such as being able to see/explore the gcode rather than just exporting it to a file but I feel that would just be duplicating the work already done in the G-code Visualizer (a polyslice dev tool) and overlap too much with the loader example. Probably best to keep this example simple/minimal for maintainability and develop more advanced features elsewhere. Any more thoughts or comments? |
Indeed, let's not make it more complex.
Have you considered to provide an ESM build that imports three.js over a So the things Polyslice needs from three.js would be imported like so: import { Color, BufferGeometry, Mesh } from 'three'; |
| "misc_controls_orbit": [ "rotation" ], | ||
| "misc_controls_trackball": [ "rotation" ], | ||
| "misc_controls_transform": [ "scale", "rotate", "translate" ], | ||
| "misc_exporter_gcode": [ "community" ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates a "community" badge in the navigation sidebar so it's clear the example uses an external component from the community.
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>

Related issue: #17981
Description
Adds integration with Polyslice, an external 3D printing slicer that converts three.js meshes directly to G-code. This addresses the discussion in #17981 where a G-code exporter was deemed too specific for three.js core and should be maintained separately with an external example.
Files Added
examples/jsm/exporters/GCodeExporter.js- A wrapper class demonstrating Polyslice integrationexamples/misc_exporter_polyslice.html- Interactive example demonstrating the GCodeExporterUsage Example
Viewing the Example
Run
npm run devfrom the repository root, then navigate tohttp://localhost:8080/examples/misc_exporter_polyslice.htmlThis contribution is funded by jgphilpott
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.