@ranchhandrobotics/babylon_ros 0.5.0 β†’ 0.6.0

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 CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- Babylon_ros is a Node.JS API for rendering [ROS 2](https://ros.org) based URDFs and Xacro in a web browser or Visual Studio Code compatible extension using [the Babylon.js graphics engine](https://www.babylonjs.com/).
6
-
5
+ Babylon_ros is a Node.JS API for rendering [ROS 2](https://ros.org) based URDFs and Xacro in a web browser or Visual Studio Code compatible extension using [the Babylon.js graphics engine](https://www.babylonjs.com/). It now includes **browser-based OpenSCAD support** for real-time SCAD to STL conversion with customizable parameters.
7
6
 
8
7
  <div align="center">
9
8
 
10
9
  [![Mule Robot Demo](https://img.shields.io/badge/πŸ€–_Interactive_Demo-View_3D_Robot-blue?style=for-the-badge&logo=github)](https://ranch-hand-robotics.github.io/babylon_ros/urdf-viewer.html?urdf=https://raw.githubusercontent.com/Ranch-Hand-Robotics/babylon_ros/main/test/testdata/mule.urdf)
10
+ [![OpenSCAD Viewer](https://img.shields.io/badge/πŸ”§_OpenSCAD_Viewer-Launch-green?style=for-the-badge&logo=github)](https://ranch-hand-robotics.github.io/babylon_ros/web/viewer-openscad.html)
11
11
 
12
12
  </div>
13
13
 
@@ -25,12 +25,25 @@ https://ranch-hand-robotics.github.io/babylon_ros/docs/urdf-viewer.html?urdf=YOU
25
25
 
26
26
  This makes it easy to embed live robot visualizations in any README by simply linking to the viewer with your URDF file URL.
27
27
 
28
+ ### OpenSCAD Viewer (NEW!)
29
+
30
+ Convert OpenSCAD files to STL directly in your browser with real-time customization:
31
+
32
+ - **Upload & Convert**: Load .scad files and convert to STL instantly
33
+ - **Customizer UI**: Automatic parameter controls from OpenSCAD comments
34
+ - **Real-time Preview**: Adjust parameters and see results immediately
35
+ - **Download Export**: Save converted STL files locally
36
+ - **Library Support**: Include OpenSCAD libraries for complex models
37
+
38
+ **Try it out**: [Online OpenSCAD Viewer](https://ranch-hand-robotics.github.io/babylon_ros/web/viewer-openscad.html)
28
39
 
29
40
  ## Features
30
41
 
31
42
  - πŸ€– **URDF and Xacro Object Model**: Loads and validates URDF and Xacro files into an object model you can access
32
- - 🌐 **Web Rendering Interface**: Access your robot's visualization from any device with a web browser
33
- - πŸ“Έ **Screenshot API**: Capture clean screenshots of your robot scenes without UI elements as base64 PNG images
43
+ - πŸ”§ **OpenSCAD Conversion**: Convert .scad files to STL in the browser using WebAssembly
44
+ - πŸŽ› **OpenSCAD Customizer**: Automatic UI generation from customizer variables in .scad files
45
+ - 🌐 **Web Rendering Interface**: Access your visualizations from any device with a web browser
46
+ - πŸ“Έ **Screenshot API**: Capture clean screenshots of your scenes without UI elements as base64 PNG images
34
47
  - πŸ“Š **Progress Tracking**: Monitor mesh/asset loading progress with callback API for custom progress bars
35
48
 
36
49
  ## Non-Features
@@ -87,6 +100,90 @@ Here’s a simple example which renders a the Test Page included in this package
87
100
  </html>
88
101
  ```
89
102
 
103
+ ## OpenSCAD Support
104
+
105
+ Babylon_ros now includes comprehensive OpenSCAD support for browser-based conversion and customization. The implementation uses WebAssembly to provide fast, client-side SCAD to STL conversion.
106
+
107
+ ### Quick Start with OpenSCAD
108
+
109
+ ```typescript
110
+ import * as babylon_ros from '@ranchhandrobotics/babylon_ros';
111
+
112
+ // Parse customizer variables from SCAD code
113
+ const scadCode = `
114
+ // width = 10
115
+ // height = 20
116
+ // radius = 5
117
+
118
+ cube([width, height, 1]);
119
+ cylinder(r=radius, h=height);
120
+ `;
121
+
122
+ const customizer = babylon_ros.parseOpenSCADCustomizer(scadCode);
123
+ console.log(customizer.variables); // Parameter list
124
+
125
+ // Convert to STL with custom parameters
126
+ const result = await babylon_ros.convertOpenSCAD({
127
+ scadContent: scadCode,
128
+ filename: 'model.scad',
129
+ parameterOverrides: { width: 20, height: 30, radius: 8 }
130
+ });
131
+
132
+ if (result.success) {
133
+ // Use result.outputData (Uint8Array of STL binary)
134
+ saveSTLFile(result.outputData, 'model.stl');
135
+ }
136
+ ```
137
+
138
+ ### Creating a Customizer UI
139
+
140
+ ```typescript
141
+ // Create UI component
142
+ const ui = babylon_ros.createOpenSCADCustomizerUI();
143
+
144
+ // Render to container with change handler
145
+ ui.render(document.getElementById('customizer-ui'), customizer, (values) => {
146
+ console.log('Parameters changed:', values);
147
+ // Re-render model with new values
148
+ });
149
+
150
+ // Programmatic access
151
+ const currentValues = ui.getValues();
152
+ ui.setValues({ width: 25 });
153
+ ```
154
+
155
+ ### Full OpenSCAD API Reference
156
+
157
+ For complete documentation on OpenSCAD integration, including:
158
+ - Web Worker implementation details
159
+ - Parameter parsing and validation
160
+ - Library file loading
161
+ - Customizer widget types
162
+ - Browser compatibility
163
+
164
+ See [OPENSCAD_README.md](./OPENSCAD_README.md) for comprehensive documentation.
165
+
166
+ ### Online OpenSCAD Viewer
167
+
168
+ A full-featured web application is available at:
169
+ - **[OpenSCAD Viewer](./web/viewer-openscad.html)** - Upload .scad files and customize in real-time
170
+
171
+ Features:
172
+ - File upload and preview
173
+ - Automatic customizer UI generation
174
+ - Real-time parameter adjustment
175
+ - STL download export
176
+ - Responsive design for mobile/desktop
177
+
178
+ ## License Notes for OpenSCAD Distribution
179
+
180
+ `babylon_ros` is MIT-licensed, but OpenSCAD functionality uses runtime artifacts from `openscad-wasm` (GPL-2.0-or-later).
181
+
182
+ If you redistribute builds that include OpenSCAD runtime artifacts, review:
183
+
184
+ - [LICENSE-COMPATIBILITY.md](LICENSE-COMPATIBILITY.md)
185
+ - [THIRDPARTYNOTICES.md](THIRDPARTYNOTICES.md)
186
+
90
187
  ## Support
91
188
  If you encounter any issues with this package, the following resources are provided:
92
189