@react-scad/core 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,12 +24,6 @@ A lot of people already think in components and JSX from building UIs. **react-s
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
## [Try it out!](https://github.com/react-scad/example)
|
|
28
|
-
|
|
29
|
-
A minimal runnable example is available at **[react-scad/example](https://github.com/react-scad/example)**. Clone it, `npm install`, then `npm start` to generate the SCAD file.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
27
|
## Getting Started
|
|
34
28
|
|
|
35
29
|
### Prerequisites
|
|
@@ -37,7 +31,22 @@ A minimal runnable example is available at **[react-scad/example](https://github
|
|
|
37
31
|
- **Node.js** 18+
|
|
38
32
|
- **React** 18 or later (peer dependency)
|
|
39
33
|
|
|
40
|
-
###
|
|
34
|
+
### Create a new project (recommended)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx create-react-scad my-project
|
|
38
|
+
cd my-project
|
|
39
|
+
npm run dev # watch mode
|
|
40
|
+
npm start # single run
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
That’s it — open the generated `model.scad` in [OpenSCAD](https://openscad.org/) or your slicer.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### Add to an existing project
|
|
48
|
+
|
|
49
|
+
#### Install
|
|
41
50
|
|
|
42
51
|
```bash
|
|
43
52
|
npm install react @react-scad/core
|
|
@@ -54,7 +63,7 @@ yarn add react @react-scad/core
|
|
|
54
63
|
|
|
55
64
|
</details>
|
|
56
65
|
|
|
57
|
-
|
|
66
|
+
#### Minimal example
|
|
58
67
|
|
|
59
68
|
Create a file `main.tsx` (or `main.jsx`):
|
|
60
69
|
|
|
@@ -79,7 +88,7 @@ root.render(
|
|
|
79
88
|
| `Union` | CSG union of all children (like `union()` in SCAD) |
|
|
80
89
|
| `Cube` / `Sphere` | Props match SCAD: `size`, `center`, `r`, `$fn`, etc. |
|
|
81
90
|
|
|
82
|
-
|
|
91
|
+
#### Run and write the `.scad` file
|
|
83
92
|
|
|
84
93
|
Run your entry file with [tsx](https://github.com/privatenumber/tsx) so Node can execute the `.tsx`. The `.scad` file is written to the **current working directory** when you call `root.render()`.
|
|
85
94
|
|
|
@@ -97,7 +106,7 @@ npx tsx watch main.tsx
|
|
|
97
106
|
|
|
98
107
|
The path you pass to `createRoot()` is relative to the current working directory.
|
|
99
108
|
|
|
100
|
-
|
|
109
|
+
#### View the result
|
|
101
110
|
|
|
102
111
|
- Open the generated `.scad` file in [OpenSCAD](https://openscad.org/) to preview, export STL, or tweak.
|
|
103
112
|
- Or import the `.scad` (or an exported STL) into your slicer for 3D printing.
|