cyclecad 3.0.0 → 3.1.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/BILLING-IMPLEMENTATION-SUMMARY.md +425 -0
- package/BILLING-INDEX.md +293 -0
- package/BILLING-INTEGRATION-GUIDE.md +414 -0
- package/COLLABORATION-INDEX.md +440 -0
- package/COLLABORATION-SYSTEM-SUMMARY.md +548 -0
- package/DOCKER-BUILD-MANIFEST.txt +483 -0
- package/DOCKER-FILES-REFERENCE.md +440 -0
- package/DOCKER-INFRASTRUCTURE.md +475 -0
- package/DOCKER-README.md +435 -0
- package/Dockerfile +33 -55
- package/PWA-FILES-CREATED.txt +350 -0
- package/QUICK-START-TESTING.md +126 -0
- package/STEP-IMPORT-QUICKSTART.md +347 -0
- package/STEP-IMPORT-SYSTEM-SUMMARY.md +502 -0
- package/app/css/mobile.css +1074 -0
- package/app/icons/generate-icons.js +203 -0
- package/app/js/billing-ui.js +990 -0
- package/app/js/brep-kernel.js +933 -981
- package/app/js/collab-client.js +750 -0
- package/app/js/mobile-nav.js +623 -0
- package/app/js/mobile-toolbar.js +476 -0
- package/app/js/modules/billing-module.js +724 -0
- package/app/js/modules/step-module-enhanced.js +938 -0
- package/app/js/offline-manager.js +705 -0
- package/app/js/responsive-init.js +360 -0
- package/app/js/touch-handler.js +429 -0
- package/app/manifest.json +211 -0
- package/app/offline.html +508 -0
- package/app/sw.js +571 -0
- package/app/tests/billing-tests.html +779 -0
- package/app/tests/brep-tests.html +980 -0
- package/app/tests/collab-tests.html +743 -0
- package/app/tests/mobile-tests.html +1299 -0
- package/app/tests/pwa-tests.html +1134 -0
- package/app/tests/step-tests.html +1042 -0
- package/app/tests/test-agent-v3.html +719 -0
- package/docker-compose.yml +225 -0
- package/docs/BILLING-HELP.json +260 -0
- package/docs/BILLING-README.md +639 -0
- package/docs/BILLING-TUTORIAL.md +736 -0
- package/docs/BREP-HELP.json +326 -0
- package/docs/BREP-TUTORIAL.md +802 -0
- package/docs/COLLABORATION-HELP.json +228 -0
- package/docs/COLLABORATION-TUTORIAL.md +818 -0
- package/docs/DOCKER-HELP.json +224 -0
- package/docs/DOCKER-TUTORIAL.md +974 -0
- package/docs/MOBILE-HELP.json +243 -0
- package/docs/MOBILE-RESPONSIVE-README.md +378 -0
- package/docs/MOBILE-TUTORIAL.md +747 -0
- package/docs/PWA-HELP.json +228 -0
- package/docs/PWA-README.md +662 -0
- package/docs/PWA-TUTORIAL.md +757 -0
- package/docs/STEP-HELP.json +481 -0
- package/docs/STEP-IMPORT-TUTORIAL.md +824 -0
- package/docs/TESTING-GUIDE.md +528 -0
- package/docs/TESTING-HELP.json +182 -0
- package/fusion-vs-cyclecad.html +1771 -0
- package/nginx.conf +237 -0
- package/package.json +1 -1
- package/server/Dockerfile.converter +51 -0
- package/server/Dockerfile.signaling +28 -0
- package/server/billing-server.js +487 -0
- package/server/converter-enhanced.py +528 -0
- package/server/requirements-converter.txt +29 -0
- package/server/signaling-server.js +801 -0
- package/tests/docker-tests.sh +389 -0
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
# STEP File Import Tutorial for cycleCAD
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
1. [What is STEP Format](#what-is-step-format)
|
|
6
|
+
2. [Getting Started](#getting-started)
|
|
7
|
+
3. [Import Methods](#import-methods)
|
|
8
|
+
4. [File Size Handling](#file-size-handling)
|
|
9
|
+
5. [Server-Side Conversion](#server-side-conversion)
|
|
10
|
+
6. [Troubleshooting](#troubleshooting)
|
|
11
|
+
7. [Performance Tips](#performance-tips)
|
|
12
|
+
8. [API Reference](#api-reference)
|
|
13
|
+
9. [Supported STEP Versions](#supported-step-versions)
|
|
14
|
+
|
|
15
|
+
## What is STEP Format
|
|
16
|
+
|
|
17
|
+
**STEP** (Standard for the Exchange of Product model data) is an ISO standard format for 3D CAD models. It's widely supported by professional CAD tools like SolidWorks, AutoCAD, Fusion 360, and FreeCAD.
|
|
18
|
+
|
|
19
|
+
### Why STEP?
|
|
20
|
+
|
|
21
|
+
- **Universal compatibility** — Works with nearly every CAD system
|
|
22
|
+
- **Preserves geometry** — Maintains B-Rep (boundary representation) data
|
|
23
|
+
- **Assembly support** — Includes component relationships and hierarchies
|
|
24
|
+
- **No license restrictions** — Open format, royalty-free to use
|
|
25
|
+
|
|
26
|
+
### File Variations
|
|
27
|
+
|
|
28
|
+
- **`.step`** or **`.stp`** — ASCII text format, human-readable but larger
|
|
29
|
+
- **`.stpz`** — Compressed STEP (less common, not supported yet)
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
### Basic Import Workflow
|
|
34
|
+
|
|
35
|
+
1. **Open cycleCAD** — Navigate to `cyclecad.com/app/`
|
|
36
|
+
2. **Click "Import STEP"** button in the toolbar or right panel
|
|
37
|
+
3. **Select a file** from your computer
|
|
38
|
+
4. **Wait for parsing** — Progress bar shows real-time status
|
|
39
|
+
5. **Model appears in 3D viewport** — Adjust camera with mouse wheel to fit view
|
|
40
|
+
|
|
41
|
+
### Import Panel
|
|
42
|
+
|
|
43
|
+
The STEP module provides a dedicated panel with:
|
|
44
|
+
|
|
45
|
+
- **Import STEP** button — Opens file picker
|
|
46
|
+
- **Export STEP** button — Saves current model to STEP (requires B-Rep kernel)
|
|
47
|
+
- **Progress bar** — Shows percentage + elapsed time
|
|
48
|
+
- **Cancel button** — Stops import if needed
|
|
49
|
+
- **Server URL** — Configurable endpoint for large files
|
|
50
|
+
- **Cache status** — Shows if previous imports are cached
|
|
51
|
+
- **Router info** — Displays which strategy will be used
|
|
52
|
+
|
|
53
|
+
## Import Methods
|
|
54
|
+
|
|
55
|
+
### Method 1: File Picker (Recommended)
|
|
56
|
+
|
|
57
|
+
Simplest way to import a local file.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
1. Click "Import STEP" button
|
|
61
|
+
2. Browser opens native file picker
|
|
62
|
+
3. Select .step or .stp file
|
|
63
|
+
4. File validation and caching is automatic
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Best for:** Small to medium files, desktop environments
|
|
67
|
+
|
|
68
|
+
### Method 2: Drag and Drop
|
|
69
|
+
|
|
70
|
+
Drag a STEP file directly onto the 3D viewport.
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
viewport.addEventListener('drop', (e) => {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
const file = e.dataTransfer.files[0];
|
|
76
|
+
cycleCAD.step.import(file);
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Best for:** Quick iteration, desktop workflows
|
|
81
|
+
|
|
82
|
+
### Method 3: Import from URL
|
|
83
|
+
|
|
84
|
+
Import a STEP file from an external URL or cloud storage.
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
// JavaScript API
|
|
88
|
+
cycleCAD.step.importFromURL('https://example.com/models/part.step');
|
|
89
|
+
|
|
90
|
+
// Or via form input
|
|
91
|
+
const url = document.getElementById('url-input').value;
|
|
92
|
+
cycleCAD.step.importFromURL(url);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Best for:** Sharing models, cloud workflows, CI/CD pipelines
|
|
96
|
+
|
|
97
|
+
### Method 4: Programmatic Import
|
|
98
|
+
|
|
99
|
+
Use the API to import files directly in your app.
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
const file = new File([buffer], 'model.step', { type: 'application/octet-stream' });
|
|
103
|
+
cycleCAD.step.import(file);
|
|
104
|
+
|
|
105
|
+
// Listen to events
|
|
106
|
+
cycleCAD.on('step:importComplete', (data) => {
|
|
107
|
+
console.log(`Imported ${data.partCount} parts`);
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Best for:** Automation, custom workflows, integrations
|
|
112
|
+
|
|
113
|
+
## File Size Handling
|
|
114
|
+
|
|
115
|
+
cycleCAD uses an intelligent routing system to handle files of any size.
|
|
116
|
+
|
|
117
|
+
### Size Categories
|
|
118
|
+
|
|
119
|
+
| Size Range | Strategy | Time | Notes |
|
|
120
|
+
|-----------|----------|------|-------|
|
|
121
|
+
| < 30 MB | Browser WASM (occt-import-js) | 2-10s | Fast, no server needed |
|
|
122
|
+
| 30-50 MB | OpenCascade.js Worker | 15-30s | Better geometry fidelity |
|
|
123
|
+
| 50-100 MB | Server converter | 30-120s | Python FastAPI + OpenCASCADE |
|
|
124
|
+
| > 100 MB | Server (with warnings) | 2-5 min | May require assembly split |
|
|
125
|
+
|
|
126
|
+
### Automatic Routing
|
|
127
|
+
|
|
128
|
+
The module automatically selects the best strategy based on:
|
|
129
|
+
|
|
130
|
+
1. **File size** — Primary factor
|
|
131
|
+
2. **Server availability** — Falls back to WASM if server unavailable
|
|
132
|
+
3. **Worker status** — Uses WASM only if Workers are ready
|
|
133
|
+
4. **WASM memory** — Respects browser memory limits
|
|
134
|
+
|
|
135
|
+
**Flow Chart:**
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
STEP File (any size)
|
|
139
|
+
↓
|
|
140
|
+
├─ < 30 MB and Worker ready?
|
|
141
|
+
│ └─ YES → Parse in WASM (occt-import-js)
|
|
142
|
+
│ └─ NO → Continue
|
|
143
|
+
│
|
|
144
|
+
├─ 30-50 MB and OpenCascade ready?
|
|
145
|
+
│ └─ YES → Parse in WASM (OpenCascade.js)
|
|
146
|
+
│ └─ NO → Continue
|
|
147
|
+
│
|
|
148
|
+
├─ Server available and healthy?
|
|
149
|
+
│ └─ YES → Upload and parse server-side
|
|
150
|
+
│ └─ NO → Fallback to browser WASM (warning)
|
|
151
|
+
│
|
|
152
|
+
└─ If all else fails → Show error with recovery steps
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### File Size Warnings
|
|
156
|
+
|
|
157
|
+
- **50-100 MB** — Shows info: "Server recommended for faster conversion"
|
|
158
|
+
- **> 100 MB** — Shows warning: "Consider splitting assembly or using server"
|
|
159
|
+
- **> 500 MB** — Shows error: "File too large, must use server converter"
|
|
160
|
+
|
|
161
|
+
## Server-Side Conversion
|
|
162
|
+
|
|
163
|
+
For large files or production workflows, use the **server-side converter**.
|
|
164
|
+
|
|
165
|
+
### What It Does
|
|
166
|
+
|
|
167
|
+
The server converter is a **FastAPI microservice** that:
|
|
168
|
+
|
|
169
|
+
1. Accepts STEP files up to 500 MB
|
|
170
|
+
2. Parses using OpenCASCADE library (Python `pythonocc-core`)
|
|
171
|
+
3. Generates adaptive mesh based on file size
|
|
172
|
+
4. Returns **GLB** (glTF 2.0 binary) for instant loading
|
|
173
|
+
5. Caches results for 24 hours
|
|
174
|
+
|
|
175
|
+
### Setup: Docker
|
|
176
|
+
|
|
177
|
+
**Fastest way to deploy:**
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Pull the image
|
|
181
|
+
docker pull cyclecad/converter:latest
|
|
182
|
+
|
|
183
|
+
# Or build locally
|
|
184
|
+
cd ~/cyclecad/server
|
|
185
|
+
docker build -t cyclecad-converter .
|
|
186
|
+
|
|
187
|
+
# Run the container
|
|
188
|
+
docker run -d \
|
|
189
|
+
--name cyclecad-converter \
|
|
190
|
+
-p 8787:8000 \
|
|
191
|
+
-e WASM_MEMORY_LIMIT=4096 \
|
|
192
|
+
cyclecad-converter:latest
|
|
193
|
+
|
|
194
|
+
# Check health
|
|
195
|
+
curl http://localhost:8787/health
|
|
196
|
+
# Response: { "status": "healthy", "wasm_available": true }
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Setup: Local (Python)
|
|
200
|
+
|
|
201
|
+
If you prefer to run directly without Docker:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Clone the repo
|
|
205
|
+
git clone https://github.com/vvlars-cmd/cyclecad
|
|
206
|
+
cd cyclecad/server
|
|
207
|
+
|
|
208
|
+
# Install dependencies
|
|
209
|
+
pip install -r requirements.txt
|
|
210
|
+
|
|
211
|
+
# Run the server
|
|
212
|
+
uvicorn converter:app --host 0.0.0.0 --port 8787
|
|
213
|
+
|
|
214
|
+
# Or with gunicorn for production
|
|
215
|
+
gunicorn -w 4 -k uvicorn.workers.UvicornWorker converter:app --bind 0.0.0.0:8787
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Configure cycleCAD to Use Server
|
|
219
|
+
|
|
220
|
+
**In the app:**
|
|
221
|
+
|
|
222
|
+
1. Open STEP module panel
|
|
223
|
+
2. Paste server URL: `http://localhost:8787/convert`
|
|
224
|
+
3. Click "Test Connection" (optional)
|
|
225
|
+
|
|
226
|
+
**Programmatically:**
|
|
227
|
+
|
|
228
|
+
```javascript
|
|
229
|
+
cycleCAD.step.setServerURL('http://localhost:8787/convert');
|
|
230
|
+
localStorage.setItem('ev_converter_url', 'http://localhost:8787/convert');
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Server Endpoints
|
|
234
|
+
|
|
235
|
+
#### POST `/convert`
|
|
236
|
+
|
|
237
|
+
Converts a STEP file to GLB.
|
|
238
|
+
|
|
239
|
+
**Request:**
|
|
240
|
+
```bash
|
|
241
|
+
curl -X POST http://localhost:8787/convert \
|
|
242
|
+
-F "file=@model.step" \
|
|
243
|
+
-F "deflection=0.05"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Response:**
|
|
247
|
+
```
|
|
248
|
+
Content-Type: model/gltf-binary
|
|
249
|
+
Body: <GLB file buffer>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### GET `/metadata`
|
|
253
|
+
|
|
254
|
+
Quick metadata extraction without full parse.
|
|
255
|
+
|
|
256
|
+
**Request:**
|
|
257
|
+
```bash
|
|
258
|
+
curl -X POST http://localhost:8787/metadata \
|
|
259
|
+
-F "file=@model.step"
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Response:**
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"part_count": 2847,
|
|
266
|
+
"assembly_count": 12,
|
|
267
|
+
"bounding_box": {
|
|
268
|
+
"min": [0, 0, 0],
|
|
269
|
+
"max": [1200, 800, 600]
|
|
270
|
+
},
|
|
271
|
+
"part_names": ["Base", "Shaft", "Bearing_1", ...],
|
|
272
|
+
"parse_time_ms": 1200
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
#### GET `/health`
|
|
277
|
+
|
|
278
|
+
Server and WASM status.
|
|
279
|
+
|
|
280
|
+
**Request:**
|
|
281
|
+
```bash
|
|
282
|
+
curl http://localhost:8787/health
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Response:**
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"status": "healthy",
|
|
289
|
+
"wasm_available": true,
|
|
290
|
+
"memory_used_mb": 512,
|
|
291
|
+
"memory_limit_mb": 4096,
|
|
292
|
+
"parser_version": "2.0.0"
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Troubleshooting
|
|
297
|
+
|
|
298
|
+
### Problem: "WASM parse failed: memory limit exceeded"
|
|
299
|
+
|
|
300
|
+
**Cause:** File too large for browser memory.
|
|
301
|
+
|
|
302
|
+
**Solutions:**
|
|
303
|
+
1. Split the assembly into sub-assemblies (< 50 MB each)
|
|
304
|
+
2. Use server converter instead: `localhost:8787`
|
|
305
|
+
3. Close other browser tabs to free memory
|
|
306
|
+
4. Increase browser memory (not possible, inherent limit)
|
|
307
|
+
|
|
308
|
+
### Problem: "WASM parsing timeout (90s). File too complex."
|
|
309
|
+
|
|
310
|
+
**Cause:** Parser took too long (file has >3000 parts or complex geometry).
|
|
311
|
+
|
|
312
|
+
**Solutions:**
|
|
313
|
+
1. Use server converter (higher timeout: 5 minutes)
|
|
314
|
+
2. Reduce geometry detail in CAD before export
|
|
315
|
+
3. Split assembly and import parts separately
|
|
316
|
+
4. Check for corrupted geometry in STEP file
|
|
317
|
+
|
|
318
|
+
### Problem: "Server converter unavailable"
|
|
319
|
+
|
|
320
|
+
**Cause:** Server not running or wrong URL.
|
|
321
|
+
|
|
322
|
+
**Solutions:**
|
|
323
|
+
1. Check server is running: `curl http://localhost:8787/health`
|
|
324
|
+
2. Check firewall allows port 8787
|
|
325
|
+
3. Verify URL in app settings
|
|
326
|
+
4. Try browser WASM as fallback
|
|
327
|
+
5. Check server logs: `docker logs cyclecad-converter`
|
|
328
|
+
|
|
329
|
+
### Problem: Imported geometry is invisible or deformed
|
|
330
|
+
|
|
331
|
+
**Causes & Solutions:**
|
|
332
|
+
1. **Scale mismatch** — STEP in meters, cycleCAD in mm? Rescale geometry
|
|
333
|
+
2. **Inverted normals** — Face backface culled. Use wireframe mode to debug
|
|
334
|
+
3. **Missing colors** — STEP file has no color data. Apply material in cycleCAD
|
|
335
|
+
4. **Bad triangulation** — Deflection too coarse. Re-import with smaller deflection
|
|
336
|
+
|
|
337
|
+
### Problem: "No meshes extracted from STEP file"
|
|
338
|
+
|
|
339
|
+
**Cause:** File is corrupted, empty, or uses unsupported STEP variant.
|
|
340
|
+
|
|
341
|
+
**Solutions:**
|
|
342
|
+
1. Open file in desktop CAD (Fusion, SolidWorks, FreeCAD) and re-save
|
|
343
|
+
2. Check STEP format version (AP203 vs AP214 vs AP242)
|
|
344
|
+
3. Try converting via online tool first: https://products.aspose.app/cad/conversion
|
|
345
|
+
4. Check file hex dump: `xxd -l 512 model.step`
|
|
346
|
+
|
|
347
|
+
**Debug Output:**
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
[StepModuleEnhanced] Worker: 0 parts in 2.3s (parse failed)
|
|
351
|
+
[StepModuleEnhanced] Import failed: No meshes extracted
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Problem: "Cannot load OpenCascade.js from CDN"
|
|
355
|
+
|
|
356
|
+
**Cause:** Network issue or CDN unavailable.
|
|
357
|
+
|
|
358
|
+
**Solutions:**
|
|
359
|
+
1. Use smaller file (< 30 MB) which uses occt-import-js instead
|
|
360
|
+
2. Check internet connection
|
|
361
|
+
3. Try later (CDN might be temporary down)
|
|
362
|
+
4. Use local fallback: edit `app.js` to use cached WASM
|
|
363
|
+
|
|
364
|
+
## Performance Tips
|
|
365
|
+
|
|
366
|
+
### 1. Use Caching
|
|
367
|
+
|
|
368
|
+
Imported models are cached in **IndexedDB** (browser local storage).
|
|
369
|
+
|
|
370
|
+
- **Cache hit** — Instant load (zero network)
|
|
371
|
+
- **Cache miss** — Parse once, reuse many times
|
|
372
|
+
- **Cache size** — Up to 50 GB depending on browser/device
|
|
373
|
+
|
|
374
|
+
**Manage cache:**
|
|
375
|
+
|
|
376
|
+
```javascript
|
|
377
|
+
// Clear cache (manual reset)
|
|
378
|
+
cycleCAD.step.clearCache();
|
|
379
|
+
|
|
380
|
+
// Check cache size
|
|
381
|
+
const caches = await caches.keys();
|
|
382
|
+
const cache = await caches.open('cyclecad-glb-v1');
|
|
383
|
+
const keys = await cache.keys();
|
|
384
|
+
console.log(`Cached ${keys.length} models`);
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### 2. Adaptive Deflection
|
|
388
|
+
|
|
389
|
+
The module automatically selects mesh density based on file size:
|
|
390
|
+
|
|
391
|
+
- **< 30 MB** → Deflection 0.01 (fine detail)
|
|
392
|
+
- **30-50 MB** → Deflection 0.02 (balanced)
|
|
393
|
+
- **50-100 MB** → Deflection 0.05 (coarser)
|
|
394
|
+
- **> 100 MB** → Deflection 0.1 (very coarse)
|
|
395
|
+
|
|
396
|
+
**Manual control:**
|
|
397
|
+
|
|
398
|
+
```javascript
|
|
399
|
+
// Force fine detail (slower)
|
|
400
|
+
const file = ...;
|
|
401
|
+
cycleCAD.step.state.deflectionDefaults.small = 0.005;
|
|
402
|
+
cycleCAD.step.import(file);
|
|
403
|
+
|
|
404
|
+
// Force coarse (faster)
|
|
405
|
+
cycleCAD.step.state.deflectionDefaults.large = 0.1;
|
|
406
|
+
cycleCAD.step.import(file);
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### 3. Batch Imports
|
|
410
|
+
|
|
411
|
+
If importing multiple files, do it sequentially to avoid memory overload:
|
|
412
|
+
|
|
413
|
+
```javascript
|
|
414
|
+
const files = [file1, file2, file3];
|
|
415
|
+
|
|
416
|
+
for (const file of files) {
|
|
417
|
+
await cycleCAD.step.import(file);
|
|
418
|
+
await new Promise(resolve => setTimeout(resolve, 500)); // Brief pause
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### 4. File Optimization
|
|
423
|
+
|
|
424
|
+
**Before importing, optimize your STEP file:**
|
|
425
|
+
|
|
426
|
+
1. **Remove unused features** — Delete construction geometry
|
|
427
|
+
2. **Reduce part count** — Merge small cosmetic parts
|
|
428
|
+
3. **Simplify surfaces** — Use lower NURBS degree
|
|
429
|
+
4. **Remove colors** — Strip color data if not needed
|
|
430
|
+
5. **Test in CAD first** — Ensure file is valid in SolidWorks/Fusion
|
|
431
|
+
|
|
432
|
+
**Command-line tools:**
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
# FreeCAD batch processing
|
|
436
|
+
freecad --headless --python optimize.py model.step
|
|
437
|
+
|
|
438
|
+
# Or use CadQuery script
|
|
439
|
+
python -c "
|
|
440
|
+
from cadquery import Workplane
|
|
441
|
+
model = Workplane().importDxf('model.step')
|
|
442
|
+
model.save('optimized.step')
|
|
443
|
+
"
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### 5. Server-Side Caching
|
|
447
|
+
|
|
448
|
+
If using server converter, it caches results for 24 hours:
|
|
449
|
+
|
|
450
|
+
```javascript
|
|
451
|
+
// Same file uploaded again = instant response (cached GLB)
|
|
452
|
+
cycleCAD.step.import(file1); // First: 2 minutes
|
|
453
|
+
cycleCAD.step.import(file1); // Second: < 1 second (cached)
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
## API Reference
|
|
457
|
+
|
|
458
|
+
### Public Methods
|
|
459
|
+
|
|
460
|
+
#### `cycleCAD.step.import(file)`
|
|
461
|
+
|
|
462
|
+
Import a STEP file.
|
|
463
|
+
|
|
464
|
+
**Parameters:**
|
|
465
|
+
- `file` (File | Blob) — STEP file object
|
|
466
|
+
|
|
467
|
+
**Returns:** Promise
|
|
468
|
+
|
|
469
|
+
**Events:**
|
|
470
|
+
- `step:importStart` — Import begins
|
|
471
|
+
- `step:importProgress` — Percent and message
|
|
472
|
+
- `step:importComplete` — Success, includes part count
|
|
473
|
+
- `step:importError` — Failure with error message
|
|
474
|
+
|
|
475
|
+
**Example:**
|
|
476
|
+
```javascript
|
|
477
|
+
const file = document.getElementById('file-input').files[0];
|
|
478
|
+
cycleCAD.step.import(file)
|
|
479
|
+
.then(() => console.log('Done'))
|
|
480
|
+
.catch(err => console.error('Failed:', err.message));
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
#### `cycleCAD.step.importFromURL(url)`
|
|
484
|
+
|
|
485
|
+
Import from a URL (cloud storage, HTTP server, etc).
|
|
486
|
+
|
|
487
|
+
**Parameters:**
|
|
488
|
+
- `url` (string) — Full URL to STEP file
|
|
489
|
+
|
|
490
|
+
**Returns:** Promise
|
|
491
|
+
|
|
492
|
+
**Example:**
|
|
493
|
+
```javascript
|
|
494
|
+
cycleCAD.step.importFromURL('https://storage.example.com/model.step');
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
#### `cycleCAD.step.export(filename)`
|
|
498
|
+
|
|
499
|
+
Export current scene to STEP format (requires B-Rep kernel).
|
|
500
|
+
|
|
501
|
+
**Parameters:**
|
|
502
|
+
- `filename` (string, optional) — Output filename (default: "model.step")
|
|
503
|
+
|
|
504
|
+
**Returns:** Promise
|
|
505
|
+
|
|
506
|
+
**Example:**
|
|
507
|
+
```javascript
|
|
508
|
+
cycleCAD.step.export('my-design.step');
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
#### `cycleCAD.step.getMetadata(file)`
|
|
512
|
+
|
|
513
|
+
Extract metadata without full parse.
|
|
514
|
+
|
|
515
|
+
**Parameters:**
|
|
516
|
+
- `file` (File | Blob) — STEP file
|
|
517
|
+
|
|
518
|
+
**Returns:** Promise<Object>
|
|
519
|
+
|
|
520
|
+
**Returns:**
|
|
521
|
+
```javascript
|
|
522
|
+
{
|
|
523
|
+
partCount: 47,
|
|
524
|
+
filename: 'model.step',
|
|
525
|
+
assemblyCount: 3,
|
|
526
|
+
boundingBox: { min: [...], max: [...] }
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
#### `cycleCAD.step.setServerURL(url)`
|
|
531
|
+
|
|
532
|
+
Change server converter endpoint.
|
|
533
|
+
|
|
534
|
+
**Parameters:**
|
|
535
|
+
- `url` (string) — New server URL (e.g., "http://localhost:8787/convert")
|
|
536
|
+
|
|
537
|
+
**Returns:** void
|
|
538
|
+
|
|
539
|
+
**Persists to localStorage.**
|
|
540
|
+
|
|
541
|
+
#### `cycleCAD.step.clearCache()`
|
|
542
|
+
|
|
543
|
+
Clear all cached GLB files.
|
|
544
|
+
|
|
545
|
+
**Returns:** Promise
|
|
546
|
+
|
|
547
|
+
**Example:**
|
|
548
|
+
```javascript
|
|
549
|
+
cycleCAD.step.clearCache().then(() => {
|
|
550
|
+
console.log('Cache cleared');
|
|
551
|
+
});
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
#### `cycleCAD.step.cancelImport()`
|
|
555
|
+
|
|
556
|
+
Cancel the current import operation.
|
|
557
|
+
|
|
558
|
+
**Returns:** void
|
|
559
|
+
|
|
560
|
+
### Events
|
|
561
|
+
|
|
562
|
+
#### `step:importStart`
|
|
563
|
+
|
|
564
|
+
Fired when import begins.
|
|
565
|
+
|
|
566
|
+
**Data:**
|
|
567
|
+
```javascript
|
|
568
|
+
{
|
|
569
|
+
filename: 'model.step',
|
|
570
|
+
size: 52428800 // bytes
|
|
571
|
+
}
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
#### `step:importProgress`
|
|
575
|
+
|
|
576
|
+
Fired during import with progress updates.
|
|
577
|
+
|
|
578
|
+
**Data:**
|
|
579
|
+
```javascript
|
|
580
|
+
{
|
|
581
|
+
percent: 45,
|
|
582
|
+
message: 'Parsing STEP (WASM)...'
|
|
583
|
+
}
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
#### `step:importComplete`
|
|
587
|
+
|
|
588
|
+
Fired when import succeeds.
|
|
589
|
+
|
|
590
|
+
**Data:**
|
|
591
|
+
```javascript
|
|
592
|
+
{
|
|
593
|
+
partCount: 47,
|
|
594
|
+
source: 'wasm' | 'server' | 'cache',
|
|
595
|
+
duration: 5234 // milliseconds
|
|
596
|
+
}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
#### `step:importError`
|
|
600
|
+
|
|
601
|
+
Fired when import fails.
|
|
602
|
+
|
|
603
|
+
**Data:**
|
|
604
|
+
```javascript
|
|
605
|
+
{
|
|
606
|
+
error: 'WASM parsing timeout (90s)',
|
|
607
|
+
suggestion: 'Use server converter or split assembly'
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
#### `step:importWarning`
|
|
612
|
+
|
|
613
|
+
Fired for non-fatal issues (large file, etc).
|
|
614
|
+
|
|
615
|
+
**Data:**
|
|
616
|
+
```javascript
|
|
617
|
+
{
|
|
618
|
+
message: 'Large file (145MB). Consider server converter.'
|
|
619
|
+
}
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### State Variables
|
|
623
|
+
|
|
624
|
+
```javascript
|
|
625
|
+
cycleCAD.step.state = {
|
|
626
|
+
importInProgress: false,
|
|
627
|
+
importCanceled: false,
|
|
628
|
+
workerReady: true,
|
|
629
|
+
opencascadeReady: true,
|
|
630
|
+
serverURL: 'http://localhost:8787/convert',
|
|
631
|
+
serverHealthy: true,
|
|
632
|
+
cacheEnabled: true,
|
|
633
|
+
lastImportInfo: { partCount: 47, filename: 'model.step' }
|
|
634
|
+
};
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
## Supported STEP Versions
|
|
638
|
+
|
|
639
|
+
### AP203 (1994)
|
|
640
|
+
|
|
641
|
+
**Also called:** STEP 1.0
|
|
642
|
+
|
|
643
|
+
**Supported:** ✅ Full support
|
|
644
|
+
|
|
645
|
+
**Common in:** Mechanical parts, assemblies
|
|
646
|
+
|
|
647
|
+
**Example:** Most SolidWorks exports, legacy CAD
|
|
648
|
+
|
|
649
|
+
### AP214 (2000)
|
|
650
|
+
|
|
651
|
+
**Also called:** STEP 2.0, "Automotive Design"
|
|
652
|
+
|
|
653
|
+
**Supported:** ✅ Full support
|
|
654
|
+
|
|
655
|
+
**Common in:** Automotive, complex assemblies
|
|
656
|
+
|
|
657
|
+
**Example:** Fusion 360, FreeCAD, modern CAD
|
|
658
|
+
|
|
659
|
+
### AP242 (2014)
|
|
660
|
+
|
|
661
|
+
**Also called:** STEP 3.0, "Managed Data Environment"
|
|
662
|
+
|
|
663
|
+
**Supported:** ⚠️ Partial (geometry OK, metadata limited)
|
|
664
|
+
|
|
665
|
+
**Common in:** Complex assemblies, Bill of Materials
|
|
666
|
+
|
|
667
|
+
**Note:** Color and assembly metadata may not transfer fully
|
|
668
|
+
|
|
669
|
+
### Other Variants
|
|
670
|
+
|
|
671
|
+
| Variant | Support | Notes |
|
|
672
|
+
|---------|---------|-------|
|
|
673
|
+
| IGES | ❌ No | Use DXF/DWG or convert via CAD |
|
|
674
|
+
| STPZ (compressed) | ❌ No | Decompress first: `unzip model.stpz` |
|
|
675
|
+
| JT (Siemens NX) | ❌ No | Export to STEP first |
|
|
676
|
+
| CATIA | ⚠️ Limited | Export to STEP/IGES first |
|
|
677
|
+
| Parasolid XT | ❌ No | Use STEP export from CAD |
|
|
678
|
+
| Pro/E ASM | ❌ No | Use STEP export from Creo |
|
|
679
|
+
|
|
680
|
+
### Conversion Tools
|
|
681
|
+
|
|
682
|
+
If your CAD format is not supported, convert to STEP first:
|
|
683
|
+
|
|
684
|
+
**Online (no install needed):**
|
|
685
|
+
- https://products.aspose.app/cad/conversion
|
|
686
|
+
- https://cloudconvert.com
|
|
687
|
+
- https://zamzar.com
|
|
688
|
+
|
|
689
|
+
**Desktop (free):**
|
|
690
|
+
- FreeCAD — Open file, File > Export As > STEP
|
|
691
|
+
- LibreCAD — Open and export to STEP
|
|
692
|
+
|
|
693
|
+
**Command-line:**
|
|
694
|
+
```bash
|
|
695
|
+
# FreeCAD headless
|
|
696
|
+
freecad --headless --python convert.py input.iges output.step
|
|
697
|
+
|
|
698
|
+
# LibreCAD headless
|
|
699
|
+
# (not available, use FreeCAD)
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
## Advanced Topics
|
|
703
|
+
|
|
704
|
+
### Custom Deflection Control
|
|
705
|
+
|
|
706
|
+
Fine-tune mesh density for specific use cases:
|
|
707
|
+
|
|
708
|
+
```javascript
|
|
709
|
+
// Very fine detail (slow, memory-heavy)
|
|
710
|
+
cycleCAD.step.state.deflectionDefaults.small = 0.001;
|
|
711
|
+
|
|
712
|
+
// Very coarse (fast, low memory)
|
|
713
|
+
cycleCAD.step.state.deflectionDefaults.large = 0.2;
|
|
714
|
+
|
|
715
|
+
// Override for a single import
|
|
716
|
+
const file = ...;
|
|
717
|
+
cycleCAD.step.import(file); // Uses current defaults
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Server Configuration
|
|
721
|
+
|
|
722
|
+
Adjust server behavior via environment variables:
|
|
723
|
+
|
|
724
|
+
```bash
|
|
725
|
+
docker run -e STEP_DEFLECTION=0.05 -e WASM_TIMEOUT=300 cyclecad-converter
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
**Available options:**
|
|
729
|
+
- `STEP_DEFLECTION` — Default mesh density (0.01-0.2)
|
|
730
|
+
- `WASM_TIMEOUT` — Parse timeout in seconds (default: 300)
|
|
731
|
+
- `WASM_MEMORY_LIMIT` — Max WASM memory in MB (default: 4096)
|
|
732
|
+
- `CACHE_TTL` — Cache time-to-live in hours (default: 24)
|
|
733
|
+
- `MAX_FILE_SIZE` — Max upload size in MB (default: 500)
|
|
734
|
+
|
|
735
|
+
### Programmatic Progress Tracking
|
|
736
|
+
|
|
737
|
+
Listen to detailed progress events:
|
|
738
|
+
|
|
739
|
+
```javascript
|
|
740
|
+
cycleCAD.on('step:importProgress', (data) => {
|
|
741
|
+
const progressBar = document.getElementById('progress');
|
|
742
|
+
progressBar.style.width = data.percent + '%';
|
|
743
|
+
|
|
744
|
+
const status = document.getElementById('status');
|
|
745
|
+
status.textContent = data.message;
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
cycleCAD.on('step:importError', (data) => {
|
|
749
|
+
console.error('Import failed:', data.error);
|
|
750
|
+
console.log('Suggestion:', data.suggestion);
|
|
751
|
+
});
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
### Batch Processing
|
|
755
|
+
|
|
756
|
+
Import multiple files and track completion:
|
|
757
|
+
|
|
758
|
+
```javascript
|
|
759
|
+
async function importBatch(files) {
|
|
760
|
+
const results = [];
|
|
761
|
+
|
|
762
|
+
for (const file of files) {
|
|
763
|
+
try {
|
|
764
|
+
const info = await cycleCAD.step.getMetadata(file);
|
|
765
|
+
await cycleCAD.step.import(file);
|
|
766
|
+
results.push({ file: file.name, success: true, parts: info.partCount });
|
|
767
|
+
} catch (e) {
|
|
768
|
+
results.push({ file: file.name, success: false, error: e.message });
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
return results;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
const files = [...document.getElementById('file-input').files];
|
|
776
|
+
const results = await importBatch(files);
|
|
777
|
+
console.table(results);
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
## FAQ
|
|
781
|
+
|
|
782
|
+
**Q: Can I import parts separately and assemble them?**
|
|
783
|
+
A: Yes! Import each STEP file separately, then use the Assembly workspace to create mates and constraints.
|
|
784
|
+
|
|
785
|
+
**Q: What's the maximum file size?**
|
|
786
|
+
A: Browser WASM: ~100 MB. Server: 500 MB (configurable). Larger files should be split in CAD.
|
|
787
|
+
|
|
788
|
+
**Q: Can I export a modified model back to STEP?**
|
|
789
|
+
A: Yes, if B-Rep kernel is loaded. File > Export STEP. Colors and some metadata may not transfer.
|
|
790
|
+
|
|
791
|
+
**Q: Does it preserve assembly structure?**
|
|
792
|
+
A: Not yet. Parts are imported as individual meshes. Assembly relationships are lost. Future release will support this.
|
|
793
|
+
|
|
794
|
+
**Q: Can I import files from Dropbox/Google Drive?**
|
|
795
|
+
A: Yes! Get a shareable link, make it public, use Import from URL.
|
|
796
|
+
|
|
797
|
+
**Q: Is there a file size limit?**
|
|
798
|
+
A: Browser: ~100 MB before it gets slow. Server: 500 MB hard limit. Files >500 MB must be split.
|
|
799
|
+
|
|
800
|
+
**Q: What CAD software exports the best STEP files?**
|
|
801
|
+
A: Fusion 360, SolidWorks, and FreeCAD. Avoid older versions or non-standard variants.
|
|
802
|
+
|
|
803
|
+
**Q: Can I run the server on a cloud provider?**
|
|
804
|
+
A: Yes! Docker container works on AWS, Google Cloud, Heroku, DigitalOcean, etc. See `docker-compose.yml` for example.
|
|
805
|
+
|
|
806
|
+
## Resources
|
|
807
|
+
|
|
808
|
+
- **STEP Format Spec** — https://en.wikipedia.org/wiki/ISO_10303
|
|
809
|
+
- **OpenCASCADE Docs** — https://dev.opencascade.org/doc
|
|
810
|
+
- **cycleCAD GitHub** — https://github.com/vvlars-cmd/cyclecad
|
|
811
|
+
- **Community Forum** — https://discourse.freecad.org/ (STEP discussions)
|
|
812
|
+
- **Convert Online** — https://products.aspose.app/cad/conversion
|
|
813
|
+
|
|
814
|
+
## Support
|
|
815
|
+
|
|
816
|
+
Found a bug? Have a feature request?
|
|
817
|
+
|
|
818
|
+
- **GitHub Issues** — https://github.com/vvlars-cmd/cyclecad/issues
|
|
819
|
+
- **Discord** — https://discord.gg/cyclecad (coming soon)
|
|
820
|
+
- **Email** — support@cyclecad.com
|
|
821
|
+
|
|
822
|
+
---
|
|
823
|
+
|
|
824
|
+
**Last Updated:** 2026-03-31 | Version 2.0.0
|