@react-scad/core 0.1.22 → 0.1.24
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 +7 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,6 @@ A lot of people already think in components and JSX from building UIs. **react-s
|
|
|
29
29
|
### Prerequisites
|
|
30
30
|
|
|
31
31
|
- **Node.js** 18+
|
|
32
|
-
- **React** 18 or later (peer dependency)
|
|
33
32
|
|
|
34
33
|
### Create a new project (recommended)
|
|
35
34
|
|
|
@@ -82,18 +81,8 @@ root.render(
|
|
|
82
81
|
);
|
|
83
82
|
```
|
|
84
83
|
|
|
85
|
-
| Piece | Meaning |
|
|
86
|
-
| ----- | ------- |
|
|
87
|
-
| `createRoot("model.scad")` | Root that writes to `model.scad` |
|
|
88
|
-
| `Union` | CSG union of all children (like `union()` in SCAD) |
|
|
89
|
-
| `Cube` / `Sphere` | Props match SCAD: `size`, `center`, `r`, `$fn`, etc. |
|
|
90
|
-
|
|
91
84
|
#### Run and write the `.scad` file
|
|
92
85
|
|
|
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()`.
|
|
94
|
-
|
|
95
|
-
> **Note:** Node doesn’t run `.tsx` by itself. Use **tsx** or bundle with esbuild (see [Advanced](#advanced) for alternatives).
|
|
96
|
-
|
|
97
86
|
```bash
|
|
98
87
|
npx tsx main.tsx
|
|
99
88
|
```
|
|
@@ -104,8 +93,6 @@ Watch mode (re-run on save):
|
|
|
104
93
|
npx tsx watch main.tsx
|
|
105
94
|
```
|
|
106
95
|
|
|
107
|
-
The path you pass to `createRoot()` is relative to the current working directory.
|
|
108
|
-
|
|
109
96
|
#### View the result
|
|
110
97
|
|
|
111
98
|
- Open the generated `.scad` file in [OpenSCAD](https://openscad.org/) to preview, export STL, or tweak.
|
|
@@ -113,7 +100,8 @@ The path you pass to `createRoot()` is relative to the current working directory
|
|
|
113
100
|
|
|
114
101
|
---
|
|
115
102
|
|
|
116
|
-
|
|
103
|
+
<details>
|
|
104
|
+
<summary>Advanced</summary>
|
|
117
105
|
|
|
118
106
|
### Custom Behavior
|
|
119
107
|
|
|
@@ -139,10 +127,10 @@ writeFileSync("out/model.scad", scadCode);
|
|
|
139
127
|
|
|
140
128
|
Then run with `npx tsx main.tsx` or bundle with esbuild and run with Node.
|
|
141
129
|
|
|
130
|
+
</details>
|
|
142
131
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
### Interop with existing SCAD
|
|
132
|
+
<details>
|
|
133
|
+
<summary>Interop with existing SCAD</summary>
|
|
146
134
|
|
|
147
135
|
You can reuse existing `.scad` libraries and snippets in two ways:
|
|
148
136
|
|
|
@@ -170,6 +158,8 @@ You can reuse existing `.scad` libraries and snippets in two ways:
|
|
|
170
158
|
|
|
171
159
|
Typical pattern: **`Import`** the library file once (at top level or where needed), then use **`Raw`** to call its modules or paste any SCAD that fits your tree.
|
|
172
160
|
|
|
161
|
+
</details>
|
|
162
|
+
|
|
173
163
|
---
|
|
174
164
|
|
|
175
165
|
## Primitives (SCAD coverage)
|