xyz-tools / gcode-preview

A simple GCode parser & previewer lib with 3D printing in mind. Written in Typescript.
https://gcode-preview.web.app/
MIT License
160 stars 31 forks source link

Section Analysis #241

Open sophiedeziel opened 3 weeks ago

sophiedeziel commented 3 weeks ago

Based on the conversation in https://github.com/remcoder/gcode-preview/issues/156

Section analysis to clip on a specific axis and position to inspect the inside of a part. As discussed, it should be simple to use and a basic implementation.

The API could be as simple as:

plane = preview.addSectionPlane({
  axis: 'x', // axis would be an enum
  position: 175, 
  direction: -1 // direction of the clipping relative to the origin.
}); 
plane.position = 60; // Control the position as needed
preview.resetSectionPlane(); // removes the clipping plane