openscad-playground/README.md

66 lines
3 KiB
Markdown
Raw Normal View History

2023-03-24 01:02:41 +00:00
# OpenSCAD Playground
2023-03-24 00:50:43 +00:00
2023-03-25 19:39:22 +00:00
[Open the Demo](https://ochafik.com/openscad2)
2023-03-24 00:50:43 +00:00
This is wrapping the headless WASM build of OpenSCAD ([done by @DSchroer](https://github.com/DSchroer/openscad-wasm)) into a lots of pretty [PrimeReact](https://github.com/primefaces/primereact) components, slapping in a [React Monaco editor](https://github.com/react-monaco-editor/react-monaco-editor) (VS Codesque power!), a [React STL viewer](https://github.com/gabotechs/react-stl-viewer) and a few tricks (of course, it's using the [experimental Manifold support](https://github.com/openscad/openscad/pull/4533) we've added recently, to make it super fast).
2023-03-26 08:56:38 +01:00
Enjoy!
An [earlier iteration of this](https://ochafik.com/openscad) offered more control over the features that are enabled. This will come soon too.
2023-03-25 19:39:22 +00:00
Licenses: see [LICENSES](./LICENSE).
2023-03-25 19:30:34 +00:00
2023-03-26 08:39:41 +01:00
## Features
2023-03-25 19:39:22 +00:00
2023-03-26 08:39:41 +01:00
- Automatic preview on edit (F5), and full rendering on Ctrl+Enter (or F6). Using a trick to force $preview=true.
2023-03-25 19:30:34 +00:00
- Syntax highlighting
2023-03-26 08:39:41 +01:00
- Ships with many standard SCAD libraries (can browse through them in the UI)
2023-03-25 19:30:34 +00:00
- Autocomplete of imports
- Autocomplete of symbols / function calls (pseudo-parses file and its transitive imports)
2023-03-26 08:39:41 +01:00
- Responsive layout (but editing on iOS is still a pain, will address that soon). On small screens editor and viewer are stacked onto each other, while on larger screens they can be side-by-side
2023-03-25 19:30:34 +00:00
2023-03-26 08:39:41 +01:00
## Roadmap
2023-03-25 19:30:34 +00:00
2023-03-26 21:16:00 +01:00
- Add tests!
- Model /home fs in shared state. have two clear paths: /libraries for builtins, and /home for user data. State pointing to /libraries paths needs not store the data except if there's overrides (flagged as modifications in the file picker)
2023-03-26 17:15:25 +01:00
- Setup [OPENSCADPATH](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries#Setting_OPENSCADPATH) env var w/ Emscripten to ensure examples will run fine.
- Bundle some official demos and more examples from each library!
2023-03-26 21:16:00 +01:00
- Ask users to contribute recipes to include more libraries, and cool examples that work in the environment
2023-03-26 08:39:41 +01:00
- Drag and drop of files (SCAD, STL, etc) and Zip archives. For assets, auto insert the corresponding import.
- Proper PWA w/ File opening / association to *.scad files
2023-03-26 17:15:25 +01:00
- Compress URL fragment
2023-03-25 19:39:22 +00:00
- Customizer support. Probably by adding --export-json or --export-format=customizer-json to OpenSCAD.
- Mobile (iOS) editing support: switch to https://www.npmjs.com/package/react-codemirror ?
2023-03-26 08:39:41 +01:00
- Proper Preview rendering: have OpenSCAD export the preview scene to a rich format (e.g. glTF, with some parts being translucent when prefixed w/ % modifier) and display it using https://modelviewer.dev/ maybe)
## Building
Prerequisites:
* wget
* GNU make
* npm
2023-03-25 19:30:34 +00:00
Local dev:
2023-03-25 19:30:34 +00:00
```bash
make public
npm start
2023-03-25 19:30:34 +00:00
# http://localhost:4000/
```
2023-03-25 19:34:07 +00:00
Local prod (test both the different inlining and serving under a prefix):
```bash
2023-03-25 19:30:34 +00:00
make public
npm run start:prod
# http://localhost:3000/dist/
Deployment (edit "homepage" in `package.json` to match your deployment root!):
```bash
make public
npm build
2023-03-25 19:30:34 +00:00
rm -fR ../ochafik.github.io/openscad2 && cp -R dist ../ochafik.github.io/openscad2
# Now commit and push changes, wait for site update and enjoy!
```