cyclecad 0.2.2 → 0.2.3
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/API-BUILD-MANIFEST.txt +339 -0
- package/API-SERVER.md +535 -0
- package/Architecture-Deck.pptx +0 -0
- package/CLAUDE.md +172 -11
- package/CLI-BUILD-SUMMARY.md +504 -0
- package/CLI-INDEX.md +356 -0
- package/CLI-README.md +466 -0
- package/COLLABORATION-INTEGRATION-GUIDE.md +325 -0
- package/CONNECTED_FABS_GUIDE.md +612 -0
- package/CONNECTED_FABS_README.md +310 -0
- package/DELIVERABLES.md +343 -0
- package/DFM-ANALYZER-INTEGRATION.md +368 -0
- package/DFM-QUICK-START.js +253 -0
- package/Dockerfile +69 -0
- package/IMPLEMENTATION.md +327 -0
- package/LICENSE +31 -0
- package/MARKETPLACE_QUICK_REFERENCE.txt +294 -0
- package/MCP-INDEX.md +264 -0
- package/QUICKSTART-API.md +388 -0
- package/QUICKSTART-CLI.md +211 -0
- package/QUICKSTART-MCP.md +196 -0
- package/README-MCP.md +208 -0
- package/TEST-TOKEN-ENGINE.md +319 -0
- package/TOKEN-ENGINE-SUMMARY.md +266 -0
- package/TOKENS-README.md +263 -0
- package/TOOLS-REFERENCE.md +254 -0
- package/app/index.html +168 -3
- package/app/js/TOKEN-INTEGRATION.md +391 -0
- package/app/js/agent-api.js +3 -3
- package/app/js/ai-copilot.js +1435 -0
- package/app/js/cam-pipeline.js +840 -0
- package/app/js/collaboration-ui.js +995 -0
- package/app/js/collaboration.js +1116 -0
- package/app/js/connected-fabs-example.js +404 -0
- package/app/js/connected-fabs.js +1449 -0
- package/app/js/dfm-analyzer.js +1760 -0
- package/app/js/marketplace.js +1994 -0
- package/app/js/material-library.js +2115 -0
- package/app/js/token-dashboard.js +563 -0
- package/app/js/token-engine.js +743 -0
- package/app/test-agent.html +1801 -0
- package/bin/cyclecad-cli.js +662 -0
- package/bin/cyclecad-mcp +2 -0
- package/bin/server.js +242 -0
- package/cycleCAD-Architecture.pptx +0 -0
- package/cycleCAD-Investor-Deck.pptx +0 -0
- package/demo-mcp.sh +60 -0
- package/docs/API-SERVER-SUMMARY.md +375 -0
- package/docs/API-SERVER.md +667 -0
- package/docs/CAM-EXAMPLES.md +344 -0
- package/docs/CAM-INTEGRATION.md +612 -0
- package/docs/CAM-QUICK-REFERENCE.md +199 -0
- package/docs/CLI-INTEGRATION.md +510 -0
- package/docs/CLI.md +872 -0
- package/docs/MARKETPLACE-API-SCHEMA.json +564 -0
- package/docs/MARKETPLACE-INTEGRATION.md +467 -0
- package/docs/MARKETPLACE-SETUP.html +439 -0
- package/docs/MCP-SERVER.md +403 -0
- package/examples/api-client-example.js +488 -0
- package/examples/api-client-example.py +359 -0
- package/examples/batch-manufacturing.txt +28 -0
- package/examples/batch-simple.txt +26 -0
- package/model-marketplace.html +1273 -0
- package/package.json +14 -3
- package/server/api-server.js +1120 -0
- package/server/mcp-server.js +1161 -0
- package/test-api-server.js +432 -0
- package/test-mcp.js +198 -0
- package/~$cycleCAD-Investor-Deck.pptx +0 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Model Marketplace - Setup Guide</title>
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
|
|
10
|
+
max-width: 900px;
|
|
11
|
+
margin: 0 auto;
|
|
12
|
+
padding: 20px;
|
|
13
|
+
background: #f5f5f5;
|
|
14
|
+
color: #333;
|
|
15
|
+
}
|
|
16
|
+
h1, h2 { color: #2c3e50; }
|
|
17
|
+
code { background: #f4f4f4; padding: 2px 6px; border-radius: 3px; font-family: monospace; }
|
|
18
|
+
pre {
|
|
19
|
+
background: #1e1e1e;
|
|
20
|
+
color: #d4d4d4;
|
|
21
|
+
padding: 15px;
|
|
22
|
+
border-radius: 5px;
|
|
23
|
+
overflow-x: auto;
|
|
24
|
+
font-size: 13px;
|
|
25
|
+
}
|
|
26
|
+
.warning {
|
|
27
|
+
background: #fff3cd;
|
|
28
|
+
border-left: 4px solid #ffc107;
|
|
29
|
+
padding: 12px;
|
|
30
|
+
margin: 15px 0;
|
|
31
|
+
}
|
|
32
|
+
.success {
|
|
33
|
+
background: #d4edda;
|
|
34
|
+
border-left: 4px solid #28a745;
|
|
35
|
+
padding: 12px;
|
|
36
|
+
margin: 15px 0;
|
|
37
|
+
}
|
|
38
|
+
.section {
|
|
39
|
+
background: white;
|
|
40
|
+
padding: 20px;
|
|
41
|
+
margin: 15px 0;
|
|
42
|
+
border-radius: 5px;
|
|
43
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
44
|
+
}
|
|
45
|
+
table {
|
|
46
|
+
width: 100%;
|
|
47
|
+
border-collapse: collapse;
|
|
48
|
+
margin: 15px 0;
|
|
49
|
+
}
|
|
50
|
+
th, td {
|
|
51
|
+
border: 1px solid #ddd;
|
|
52
|
+
padding: 12px;
|
|
53
|
+
text-align: left;
|
|
54
|
+
}
|
|
55
|
+
th {
|
|
56
|
+
background: #f8f9fa;
|
|
57
|
+
font-weight: bold;
|
|
58
|
+
}
|
|
59
|
+
.api-method {
|
|
60
|
+
background: #f9f9f9;
|
|
61
|
+
border-left: 3px solid #58a6ff;
|
|
62
|
+
padding: 12px;
|
|
63
|
+
margin: 10px 0;
|
|
64
|
+
font-family: monospace;
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
67
|
+
</head>
|
|
68
|
+
<body>
|
|
69
|
+
|
|
70
|
+
<h1>🛍️ Model Marketplace - Quick Setup</h1>
|
|
71
|
+
|
|
72
|
+
<p>Complete integration guide for cycleCAD Model Marketplace module.</p>
|
|
73
|
+
|
|
74
|
+
<div class="section">
|
|
75
|
+
<h2>Step 1: Import the Module</h2>
|
|
76
|
+
<p>In <code>app/index.html</code>, add this script tag in the <code><head></code>:</p>
|
|
77
|
+
<pre><script type="module">
|
|
78
|
+
import { initMarketplace } from './js/marketplace.js';
|
|
79
|
+
|
|
80
|
+
// In your module initialization section:
|
|
81
|
+
// After all other modules (viewport, sketch, operations, etc.) are ready
|
|
82
|
+
|
|
83
|
+
window.addEventListener('DOMContentLoaded', async () => {
|
|
84
|
+
// ... existing module initializations ...
|
|
85
|
+
|
|
86
|
+
// Initialize marketplace
|
|
87
|
+
const mpResult = initMarketplace({
|
|
88
|
+
viewport: _viewport, // THREE.js viewport
|
|
89
|
+
tokenEngine: _tokenEngine // Optional: token engine instance
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.log('[APP] Marketplace initialized:', mpResult);
|
|
93
|
+
});
|
|
94
|
+
</script></pre>
|
|
95
|
+
|
|
96
|
+
<div class="success">
|
|
97
|
+
✅ The module auto-creates:<br/>
|
|
98
|
+
• A toolbar button "🛍️ Marketplace"<br/>
|
|
99
|
+
• A fixed-position panel on the right side<br/>
|
|
100
|
+
• All UI styles
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<div class="section">
|
|
105
|
+
<h2>Step 2: Access the API</h2>
|
|
106
|
+
<p>The marketplace is exposed globally as:</p>
|
|
107
|
+
<pre>window.cycleCAD.marketplace</pre>
|
|
108
|
+
|
|
109
|
+
<p>Try it in the browser console:</p>
|
|
110
|
+
<pre>// Search for models
|
|
111
|
+
window.cycleCAD.marketplace.search('bolt')
|
|
112
|
+
|
|
113
|
+
// Get creator stats
|
|
114
|
+
window.cycleCAD.marketplace.getCreatorStats()
|
|
115
|
+
|
|
116
|
+
// Browse mechanical models
|
|
117
|
+
window.cycleCAD.marketplace.browse('Mechanical', { sort: 'popular' })</pre>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<div class="section">
|
|
121
|
+
<h2>Step 3: Publish Your First Model</h2>
|
|
122
|
+
|
|
123
|
+
<h3>Method A: Via UI</h3>
|
|
124
|
+
<ol>
|
|
125
|
+
<li>Click "🛍️ Marketplace" button in toolbar</li>
|
|
126
|
+
<li>Click "Publish" tab</li>
|
|
127
|
+
<li>Fill out the form with model details</li>
|
|
128
|
+
<li>Click "Publish Model"</li>
|
|
129
|
+
</ol>
|
|
130
|
+
|
|
131
|
+
<h3>Method B: Via API</h3>
|
|
132
|
+
<pre>// From browser console or agent code
|
|
133
|
+
const result = window.cycleCAD.marketplace.publish({
|
|
134
|
+
name: 'My Awesome Part',
|
|
135
|
+
description: 'A high-quality mechanical component',
|
|
136
|
+
category: 'Mechanical', // Must be one of the 6 categories
|
|
137
|
+
tags: ['metal', 'precision', 'oem'],
|
|
138
|
+
tiers: [
|
|
139
|
+
{ id: 2, name: 'Mesh Download', price: 50 }
|
|
140
|
+
],
|
|
141
|
+
sourceGeometry: geometry, // THREE.BufferGeometry (optional)
|
|
142
|
+
parametricData: paramJson, // JSON (optional)
|
|
143
|
+
metadata: {
|
|
144
|
+
material: 'aluminum',
|
|
145
|
+
weight: 0.25,
|
|
146
|
+
dimensions: { x: 50, y: 40, z: 30 }
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
console.log('Published!', result.modelId);</pre>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div class="section">
|
|
154
|
+
<h2>Step 4: Integrate with Agent API</h2>
|
|
155
|
+
|
|
156
|
+
<p>The marketplace is already integrated with <code>window.cycleCAD</code> agent commands:</p>
|
|
157
|
+
|
|
158
|
+
<pre>// Agent publishes a model
|
|
159
|
+
await window.cycleCAD.execute({
|
|
160
|
+
method: 'marketplace.publish',
|
|
161
|
+
params: {
|
|
162
|
+
name: 'AI-Generated Bracket',
|
|
163
|
+
description: 'Auto-generated support structure',
|
|
164
|
+
category: 'Structural',
|
|
165
|
+
tags: ['ai', 'generated']
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// Agent searches for parts
|
|
170
|
+
await window.cycleCAD.execute({
|
|
171
|
+
method: 'marketplace.search',
|
|
172
|
+
params: { query: 'bolt', minRating: 4.0 }
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// Agent purchases a model
|
|
176
|
+
await window.cycleCAD.execute({
|
|
177
|
+
method: 'marketplace.purchase',
|
|
178
|
+
params: { modelId: 'abc-123', tierId: 3 }
|
|
179
|
+
});</pre>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<div class="section">
|
|
183
|
+
<h2>Complete API Reference</h2>
|
|
184
|
+
|
|
185
|
+
<table>
|
|
186
|
+
<tr>
|
|
187
|
+
<th>Function</th>
|
|
188
|
+
<th>Returns</th>
|
|
189
|
+
<th>Description</th>
|
|
190
|
+
</tr>
|
|
191
|
+
<tr>
|
|
192
|
+
<td><code>publish(modelData)</code></td>
|
|
193
|
+
<td><code>{ ok, modelId, model }</code></td>
|
|
194
|
+
<td>Publish a new model to marketplace</td>
|
|
195
|
+
</tr>
|
|
196
|
+
<tr>
|
|
197
|
+
<td><code>search(query, filters)</code></td>
|
|
198
|
+
<td><code>{ ok, results[], total, page, hasMore }</code></td>
|
|
199
|
+
<td>Full-text search with optional filters</td>
|
|
200
|
+
</tr>
|
|
201
|
+
<tr>
|
|
202
|
+
<td><code>browse(category, opts)</code></td>
|
|
203
|
+
<td><code>{ ok, results[], total, page, hasMore }</code></td>
|
|
204
|
+
<td>Browse by category with sorting</td>
|
|
205
|
+
</tr>
|
|
206
|
+
<tr>
|
|
207
|
+
<td><code>getDetails(modelId)</code></td>
|
|
208
|
+
<td><code>{ ok, model, creator, canDownload }</code></td>
|
|
209
|
+
<td>Get full model details + preview</td>
|
|
210
|
+
</tr>
|
|
211
|
+
<tr>
|
|
212
|
+
<td><code>purchase(modelId, tierId)</code></td>
|
|
213
|
+
<td><code>{ ok, purchaseId, accessUrl, expiryDate }</code></td>
|
|
214
|
+
<td>Purchase model at tier</td>
|
|
215
|
+
</tr>
|
|
216
|
+
<tr>
|
|
217
|
+
<td><code>download(modelId, format)</code></td>
|
|
218
|
+
<td><code>{ ok, data, filename, mimeType }</code></td>
|
|
219
|
+
<td>Download purchased model</td>
|
|
220
|
+
</tr>
|
|
221
|
+
<tr>
|
|
222
|
+
<td><code>getPurchaseHistory()</code></td>
|
|
223
|
+
<td><code>[ purchase[], ... ]</code></td>
|
|
224
|
+
<td>Get user's purchased models</td>
|
|
225
|
+
</tr>
|
|
226
|
+
<tr>
|
|
227
|
+
<td><code>getCreatorStats(period)</code></td>
|
|
228
|
+
<td><code>{ ok, stats: { earnings, downloads, avgRating, ... } }</code></td>
|
|
229
|
+
<td>Get creator dashboard stats</td>
|
|
230
|
+
</tr>
|
|
231
|
+
<tr>
|
|
232
|
+
<td><code>getCreatorProfile(creatorId)</code></td>
|
|
233
|
+
<td><code>{ ok, profile }</code></td>
|
|
234
|
+
<td>Get any creator's public profile</td>
|
|
235
|
+
</tr>
|
|
236
|
+
<tr>
|
|
237
|
+
<td><code>listMyModels()</code></td>
|
|
238
|
+
<td><code>[ model[], ... ]</code></td>
|
|
239
|
+
<td>List all models published by current user</td>
|
|
240
|
+
</tr>
|
|
241
|
+
<tr>
|
|
242
|
+
<td><code>updateModel(modelId, updates)</code></td>
|
|
243
|
+
<td><code>{ ok, model }</code></td>
|
|
244
|
+
<td>Update model (creator only)</td>
|
|
245
|
+
</tr>
|
|
246
|
+
<tr>
|
|
247
|
+
<td><code>deleteModel(modelId)</code></td>
|
|
248
|
+
<td><code>{ ok }</code></td>
|
|
249
|
+
<td>Delete model (creator only)</td>
|
|
250
|
+
</tr>
|
|
251
|
+
<tr>
|
|
252
|
+
<td><code>addReview(modelId, rating, comment)</code></td>
|
|
253
|
+
<td><code>{ ok, review }</code></td>
|
|
254
|
+
<td>Leave review on purchased model</td>
|
|
255
|
+
</tr>
|
|
256
|
+
<tr>
|
|
257
|
+
<td><code>getReviews(modelId, page, pageSize)</code></td>
|
|
258
|
+
<td><code>{ ok, reviews[], total, hasMore }</code></td>
|
|
259
|
+
<td>Get paginated reviews</td>
|
|
260
|
+
</tr>
|
|
261
|
+
<tr>
|
|
262
|
+
<td><code>getEarningsBreakdown(period)</code></td>
|
|
263
|
+
<td><code>{ ok, breakdown, total }</code></td>
|
|
264
|
+
<td>Get earnings by day/week/month</td>
|
|
265
|
+
</tr>
|
|
266
|
+
<tr>
|
|
267
|
+
<td><code>withdrawEarnings(amount, method)</code></td>
|
|
268
|
+
<td><code>{ ok, withdrawalId, status }</code></td>
|
|
269
|
+
<td>Request payout (Stripe/crypto placeholder)</td>
|
|
270
|
+
</tr>
|
|
271
|
+
</table>
|
|
272
|
+
</div>
|
|
273
|
+
|
|
274
|
+
<div class="section">
|
|
275
|
+
<h2>Model Categories (6 Options)</h2>
|
|
276
|
+
<pre>1. Mechanical - Motors, bearings, shafts, couplings
|
|
277
|
+
2. Structural - Brackets, frames, supports
|
|
278
|
+
3. Enclosure - Boxes, cabinets, housings
|
|
279
|
+
4. Fastener - Bolts, screws, nuts, washers
|
|
280
|
+
5. Custom - Domain-specific, proprietary parts
|
|
281
|
+
6. Template - Parametric templates, configurable</pre>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<div class="section">
|
|
285
|
+
<h2>Access Tiers (7 Pricing Tiers)</h2>
|
|
286
|
+
<table>
|
|
287
|
+
<tr>
|
|
288
|
+
<th>Tier</th>
|
|
289
|
+
<th>ID</th>
|
|
290
|
+
<th>Price</th>
|
|
291
|
+
<th>What's Included</th>
|
|
292
|
+
</tr>
|
|
293
|
+
<tr>
|
|
294
|
+
<td>Free Preview</td>
|
|
295
|
+
<td>1</td>
|
|
296
|
+
<td>0 tokens</td>
|
|
297
|
+
<td>View preview only</td>
|
|
298
|
+
</tr>
|
|
299
|
+
<tr>
|
|
300
|
+
<td>Mesh Download</td>
|
|
301
|
+
<td>2</td>
|
|
302
|
+
<td>50 tokens</td>
|
|
303
|
+
<td>STL/OBJ exports</td>
|
|
304
|
+
</tr>
|
|
305
|
+
<tr>
|
|
306
|
+
<td>Parametric</td>
|
|
307
|
+
<td>3</td>
|
|
308
|
+
<td>200 tokens</td>
|
|
309
|
+
<td>JSON editable format</td>
|
|
310
|
+
</tr>
|
|
311
|
+
<tr>
|
|
312
|
+
<td>Full IP</td>
|
|
313
|
+
<td>4</td>
|
|
314
|
+
<td>1,000 tokens</td>
|
|
315
|
+
<td>STEP + source + history</td>
|
|
316
|
+
</tr>
|
|
317
|
+
<tr>
|
|
318
|
+
<td>Commercial Use</td>
|
|
319
|
+
<td>5</td>
|
|
320
|
+
<td>2,000 tokens</td>
|
|
321
|
+
<td>License for resale</td>
|
|
322
|
+
</tr>
|
|
323
|
+
<tr>
|
|
324
|
+
<td>Derivative</td>
|
|
325
|
+
<td>6</td>
|
|
326
|
+
<td>15% of parent</td>
|
|
327
|
+
<td>Fork & modify license</td>
|
|
328
|
+
</tr>
|
|
329
|
+
<tr>
|
|
330
|
+
<td>Agent Access</td>
|
|
331
|
+
<td>7</td>
|
|
332
|
+
<td>5 tokens/query</td>
|
|
333
|
+
<td>Programmatic API access</td>
|
|
334
|
+
</tr>
|
|
335
|
+
</table>
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
<div class="section">
|
|
339
|
+
<h2>Events API</h2>
|
|
340
|
+
|
|
341
|
+
<p>Listen to marketplace events:</p>
|
|
342
|
+
|
|
343
|
+
<pre>// Model published
|
|
344
|
+
window.cycleCAD.marketplace.on('modelPublished', (data) => {
|
|
345
|
+
console.log(`Model "${data.modelName}" published as ${data.modelId}`);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// Model purchased
|
|
349
|
+
window.cycleCAD.marketplace.on('modelPurchased', (data) => {
|
|
350
|
+
console.log(`Purchased ${data.modelId} tier ${data.tierId} for ${data.price} tokens`);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// Review added
|
|
354
|
+
window.cycleCAD.marketplace.on('reviewAdded', (data) => {
|
|
355
|
+
console.log(`Review ${data.rating}★ on ${data.modelId}`);
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// Model downloaded
|
|
359
|
+
window.cycleCAD.marketplace.on('modelDownloaded', (data) => {
|
|
360
|
+
console.log(`Downloaded: ${data.filename}`);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
// Earnings withdrawal requested
|
|
364
|
+
window.cycleCAD.marketplace.on('withdrawalRequested', (data) => {
|
|
365
|
+
console.log(`${data.amount} tokens → ${data.method}`);
|
|
366
|
+
});</pre>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<div class="section">
|
|
370
|
+
<h2>Common Use Cases</h2>
|
|
371
|
+
|
|
372
|
+
<h3>1. Creator Publishing a Model</h3>
|
|
373
|
+
<pre>// After designing a part in cycleCAD
|
|
374
|
+
const { mesh, geometry } = getCurrentModel();
|
|
375
|
+
|
|
376
|
+
window.cycleCAD.marketplace.publish({
|
|
377
|
+
name: 'Precision Shaft Adapter',
|
|
378
|
+
description: 'High-tolerance adapter for 12mm shafts',
|
|
379
|
+
category: 'Mechanical',
|
|
380
|
+
tags: ['shaft', 'adapter', 'precision', 'metal'],
|
|
381
|
+
sourceGeometry: geometry,
|
|
382
|
+
tiers: [
|
|
383
|
+
{ id: 2, name: 'Mesh', price: 50 },
|
|
384
|
+
{ id: 3, name: 'Parametric', price: 200 }
|
|
385
|
+
]
|
|
386
|
+
});</pre>
|
|
387
|
+
|
|
388
|
+
<h3>2. Engineer Finding a Fastener</h3>
|
|
389
|
+
<pre>// Search marketplace for specific bolt
|
|
390
|
+
const results = window.cycleCAD.marketplace.search('M8 hex bolt', {
|
|
391
|
+
minRating: 4.5,
|
|
392
|
+
priceMax: 100
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
// Click result to view details
|
|
396
|
+
results.results.forEach(model => {
|
|
397
|
+
console.log(`${model.name} - ${model.stats.rating}★ - ${model.tiers[0].price} tokens`);
|
|
398
|
+
});</pre>
|
|
399
|
+
|
|
400
|
+
<h3>3. Purchasing & Using a Model</h3>
|
|
401
|
+
<pre>// Purchase a model
|
|
402
|
+
const purchase = window.cycleCAD.marketplace.purchase(modelId, 3); // Tier 3 = Parametric
|
|
403
|
+
|
|
404
|
+
// Download the model
|
|
405
|
+
const download = window.cycleCAD.marketplace.download(modelId, 'json');
|
|
406
|
+
|
|
407
|
+
// Import into current project
|
|
408
|
+
loadCycleCADModel(download.data);</pre>
|
|
409
|
+
|
|
410
|
+
<h3>4. Creator Dashboard Workflow</h3>
|
|
411
|
+
<pre>// Get all my published models
|
|
412
|
+
const myModels = window.cycleCAD.marketplace.listMyModels();
|
|
413
|
+
|
|
414
|
+
// Check earnings
|
|
415
|
+
const stats = window.cycleCAD.marketplace.getCreatorStats('all');
|
|
416
|
+
console.log(`Total earnings: ${stats.stats.totalEarnings} tokens`);
|
|
417
|
+
console.log(`Total downloads: ${stats.stats.totalDownloads}`);
|
|
418
|
+
|
|
419
|
+
// Withdraw earnings
|
|
420
|
+
window.cycleCAD.marketplace.withdrawEarnings(5000, 'stripe');</pre>
|
|
421
|
+
|
|
422
|
+
<h3>5. AI Agent Publishing & Selling Models</h3>
|
|
423
|
+
<pre>// Agent auto-generates design
|
|
424
|
+
const design = await generateDesignFromPrompt('Lightweight bracket for drone');
|
|
425
|
+
|
|
426
|
+
// Publish to marketplace
|
|
427
|
+
const result = await window.cycleCAD.execute({
|
|
428
|
+
method: 'marketplace.publish',
|
|
429
|
+
params: {
|
|
430
|
+
name: 'AI-Generated Drone Bracket',
|
|
431
|
+
description: 'Lightweight, optimized for additive manufacturing',
|
|
432
|
+
category: 'Custom',
|
|
433
|
+
tags: ['ai', 'lightweight', 'drone', 'fdm'],
|
|
434
|
+
sourceGeometry: design.geometry,
|
|
435
|
+
tiers: [{ id: 3, price: 200 }]
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
// Agent can now earn tokens when others download!
|