partcad-cli 0.3.1__tar.gz → 0.3.62__tar.gz

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.
Files changed (23) hide show
  1. partcad-cli-0.3.62/PKG-INFO +481 -0
  2. partcad-cli-0.3.62/README.md +459 -0
  3. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/pyproject.toml +2 -2
  4. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/requirements.txt +1 -1
  5. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/__init__.py +1 -1
  6. partcad-cli-0.3.62/src/partcad_cli.egg-info/PKG-INFO +481 -0
  7. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli.egg-info/SOURCES.txt +1 -0
  8. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli.egg-info/requires.txt +1 -1
  9. partcad-cli-0.3.1/PKG-INFO +0 -21
  10. partcad-cli-0.3.1/src/partcad_cli.egg-info/PKG-INFO +0 -21
  11. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/setup.cfg +0 -0
  12. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/cli.py +0 -0
  13. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/cli_add.py +0 -0
  14. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/cli_init.py +0 -0
  15. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/cli_install.py +0 -0
  16. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/cli_list.py +0 -0
  17. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/cli_render.py +0 -0
  18. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/cli_show.py +0 -0
  19. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/template/init-private.yaml +0 -0
  20. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli/template/init-public.yaml +0 -0
  21. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli.egg-info/dependency_links.txt +0 -0
  22. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli.egg-info/entry_points.txt +0 -0
  23. {partcad-cli-0.3.1 → partcad-cli-0.3.62}/src/partcad_cli.egg-info/top_level.txt +0 -0
@@ -0,0 +1,481 @@
1
+ Metadata-Version: 2.1
2
+ Name: partcad-cli
3
+ Version: 0.3.62
4
+ Summary: Command-line interface to PartCAD
5
+ Author-email: Roman Kuzmenko <openvmp@proton.me>
6
+ Maintainer-email: Roman Kuzmenko <openvmp@proton.me>
7
+ Project-URL: Homepage, https://github.com/openvmp/partcad
8
+ Project-URL: Issues, https://github.com/openvmp/partcad/issues
9
+ Keywords: cadquery,build123d,cad,design,openscad,step,stl
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: partcad==0.3.62
16
+ Requires-Dist: pycairo
17
+ Requires-Dist: renderlab
18
+ Requires-Dist: rlPyCairo
19
+ Requires-Dist: svglib
20
+ Requires-Dist: ocp_vscode
21
+ Requires-Dist: progress
22
+
23
+ # PartCAD <!-- omit in toc -->
24
+
25
+ [![License](https://github.com/openvmp/partcad/blob/main//apache20.svg?raw=true)](./LICENSE.txt)
26
+
27
+ [![CI on Linux, MacOS and Windows](https://github.com/openvmp/partcad/actions/workflows/python-test.yml/badge.svg)](https://github.com/openvmp/partcad/actions/workflows/python-test.yml)
28
+ [![CD on Linux, MacOS and Windows](https://github.com/openvmp/partcad/actions/workflows/python-build.yml/badge.svg)](https://github.com/openvmp/partcad/actions/workflows/python-build.yml)
29
+ [![Deployment to PyPI](https://github.com/openvmp/partcad/actions/workflows/python-deploy.yml/badge.svg)](https://github.com/openvmp/partcad/actions/workflows/python-deploy.yml)
30
+
31
+ PartCAD is the first package manager for CAD models,
32
+ and a Python package to consume these packages in CAD scripts ([`cadquery`][CadQuery] and [`build123d`][build123d]).
33
+ It brings the same power to CAD scripting
34
+ as [pip](https://pypi.org/) to Python,
35
+ [npm](https://www.npmjs.com/) to JavaScript,
36
+ [maven](https://maven.apache.org/) to Java etc.
37
+ Though it aims to achieve the integrity and security properties of
38
+ [bazel](https://bazel.build/) which makes PartCAD quite distinct from `pip` and `npm`.
39
+
40
+ [Join our Discord channel!](https://discord.gg/AXbP47zYw5)
41
+
42
+ PartCAD allows to maintain information about mechanical parts,
43
+ how they come together to form larger assemblies,
44
+ and to reuse the same parts in multiple assemblies, multiple projects.
45
+ The implementation of parts can change over time
46
+ (e.g. optimize or migrate to [CadQuery] from [STEP]) without the need to update
47
+ all of the consumers.
48
+
49
+ - [Installation](#installation)
50
+ - [Browse models published to PartCAD](#browse-models-published-to-partcad)
51
+ - [Consume PartCAD models](#consume-partcad-models)
52
+ - [Create PartCAD models](#create-partcad-models)
53
+ - [Parts](#parts)
54
+ - [Assemblies](#assemblies)
55
+ - [Packages](#packages)
56
+ - [Troubleshooting](#troubleshooting)
57
+ - [Render your project](#render-your-project)
58
+ - [Publishing](#publishing)
59
+ - [Export](#export)
60
+ - [Images](#images)
61
+ - [Purchasing / Bill of materials](#purchasing--bill-of-materials)
62
+ - [Security](#security)
63
+ - [Tools for mechanical engineering](#tools-for-mechanical-engineering)
64
+ - [History](#history)
65
+
66
+ ## Installation
67
+
68
+ The recommended method to install PartCAD for most users is:
69
+
70
+ ```shell
71
+ pip install partcad-cli
72
+ ```
73
+
74
+ For contributors:
75
+
76
+ ```shell
77
+ git clone https://github.com/openvmp/partcad.git
78
+ cd partcad
79
+ python3 -m pip install -e ./partcad
80
+ python3 -m pip install -e ./partcad-cli
81
+ ```
82
+
83
+ PartCAD works best when [conda](https://docs.conda.io/) is installed.
84
+ Moreover, on Windows it is recommended to use PartCAD from within a `conda`
85
+ environment.
86
+
87
+ ## Browse models published to PartCAD
88
+
89
+ To browse the public PartCAD repository from the command line:
90
+
91
+ ```sh
92
+ $ pc init # to initialize new PartCAD package in the current folder
93
+ $ pc list # to list all available packages
94
+ $ pc list-parts -r # to list all parts in all available packages
95
+ $ pc list-assemblies -r # to list all assemblies in all available packages
96
+ ```
97
+
98
+ The web UI to browse the public PartCAD repository is not yet published.
99
+
100
+ ## Consume PartCAD models
101
+
102
+ As PartCAD has no implicit dependencies built in, the current directory needs to be initialized as a PartCAD package and a dependency on the public PartCAD repository needs to be registered.
103
+
104
+ ```sh
105
+ # Initialize new PartCAD package in the current folder
106
+ $ pc init
107
+ ```
108
+
109
+ Alternatively, manually create `partcad.yaml` with the following content:
110
+
111
+ ```yaml
112
+ # partcad.yaml
113
+ import:
114
+ partcad-index: # Standard public PartCAD repository (needs to be explicitly referenced to be used)
115
+ type: git
116
+ url: https://github.com/openvmp/partcad-index.git
117
+ ```
118
+
119
+ After this, PartCAD python module can be used to retrieve any model.
120
+ The exact way to do this depends on the CAD framework used in your project:
121
+
122
+ <table>
123
+ <tr>
124
+ <td>
125
+ <code># CadQuery
126
+ import cadquery as cq
127
+ import partcad as pc
128
+ part = pc.get_part(
129
+ # Part name
130
+ "fastener/screw-buttonhead",
131
+ # Package name
132
+ "standard-metric-cqwarehouse",
133
+ ).get_cadquery()
134
+ ...
135
+ show_object(part)</code>
136
+ </td>
137
+ <td>
138
+ <code># build123d
139
+ import build123d as b3d
140
+ import partcad as pc
141
+ part = pc.get_part(
142
+ # Part name
143
+ "fastener/screw-buttonhead",
144
+ # Package name
145
+ "standard-metric-cqwarehouse",
146
+ ).get_build123d()
147
+ ...
148
+ show_object(part)</code>
149
+ </td>
150
+ <!--
151
+ <td>
152
+ <code># No framework, standalone
153
+ import partcad as pc
154
+ part = pc.get_part(
155
+ # Part name
156
+ "fastener/screw-buttonhead",
157
+ # Package name
158
+ "standard-metric-cqwarehouse",
159
+ ).get_build123d()
160
+ ...
161
+ pc.finalize(part)</code>
162
+ </td>
163
+ -->
164
+ </tr>
165
+ </table>
166
+
167
+
168
+ ## Create PartCAD models
169
+
170
+ This frameworks allows to create large models and scenes, one part at a time,
171
+ while having parts and assemblies often maintained by third parties.
172
+
173
+ ### Parts
174
+
175
+ PartCAD allows to define parts using any of the following methods:
176
+
177
+ <table>
178
+ <tr>
179
+ <th>Method</td>
180
+ <th>Example</td>
181
+ <th>Result</td>
182
+ </tr>
183
+ <tr>
184
+ <td><a href="https://github.com/CadQuery/cadquery">CadQuery</a></td>
185
+ <td>
186
+ <code># partcad.yaml
187
+ parts:
188
+ cube:
189
+ type: cadquery</code>
190
+ <br/>
191
+ <br/>
192
+ Place the CadQuery script in "cube.py"
193
+ </td>
194
+ <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_cadquery_primitive/cube.png?raw=true"></td>
195
+ </tr>
196
+ <tr>
197
+ <td><a href="https://github.com/gumyr/build123d">build123d</a></td>
198
+ <td>
199
+ <code># partcad.yaml
200
+ parts:
201
+ cube:
202
+ type: build123d</code>
203
+
204
+ <br/>
205
+ Place the build123d script in "cube.py"
206
+ </td>
207
+ <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_cadquery_primitive/cube.png?raw=true"></td>
208
+ </tr>
209
+ <tr>
210
+ <td><a href="https://en.wikipedia.org/wiki/ISO_10303">STEP</a></td>
211
+ <td>
212
+ <code># partcad.yaml
213
+ parts:
214
+ bolt:
215
+ type: step</code>
216
+
217
+ <br/>
218
+ Store the model in "bolt.step"
219
+ </td>
220
+ <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_step/bolt.png?raw=true"></td>
221
+ </tr>
222
+ <tr>
223
+ <td><a href="https://en.wikipedia.org/wiki/STL_(file_format)">STL</a></td>
224
+ <td>
225
+ <code># partcad.yaml
226
+ parts:
227
+ cube:
228
+ type: stl</code>
229
+
230
+ <br/>
231
+ Store the model in "cube.stl"
232
+ </td>
233
+ <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_stl/cube.png?raw=true"></td>
234
+ </tr>
235
+ <tr>
236
+ <td><a href="https://en.wikipedia.org/wiki/3D_Manufacturing_Format">3MF</a></td>
237
+ <td>
238
+ <code># partcad.yaml
239
+ parts:
240
+ cube:
241
+ type: 3mf</code>
242
+
243
+ <br/>
244
+ Store the model in "cube.3mf"
245
+ </td>
246
+ <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_3mf/cube.png?raw=true"></td>
247
+ </tr>
248
+ <tr>
249
+ <td><a href="https://en.wikipedia.org/wiki/OpenSCAD">OpenSCAD</a></td>
250
+ <td>
251
+ <code># partcad.yaml
252
+ parts:
253
+ cube:
254
+ type: scad</code>
255
+
256
+ <br/>
257
+ Store the model in "cube.scad"
258
+ </td>
259
+ <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_scad/cube.png?raw=true"></td>
260
+ </tr>
261
+ </table>
262
+
263
+ Other methods to define parts are coming in soon (e.g. SCAD).
264
+
265
+ ### Assemblies
266
+
267
+ Assemblies are defined as parametrized instructions how to put parts and other
268
+ assemblies together.
269
+
270
+ Currently, PartCAD allows to define parts only using ASSY (Assembly YAML):
271
+
272
+ <table>
273
+ <tr>
274
+ <th>Example</td>
275
+ <th>Result</td>
276
+ </tr>
277
+ <tr>
278
+ <td>
279
+ <code># partcad.yaml
280
+ assemblies:
281
+ logo:
282
+ type: assy</code>
283
+
284
+ <br/>
285
+ <code># logo.assy
286
+ links:
287
+ - part: bone
288
+ package: example_part_cadquery_logo
289
+ location: [[0,0,0], [0,0,1], 0]
290
+ - part: bone
291
+ package: example_part_cadquery_logo
292
+ location: [[0,0,-2.5], [0,0,1], -90]
293
+ - part: head_half
294
+ package: example_part_cadquery_logo
295
+ name: head_half_1
296
+ location: [[0,0,27.5], [0,0,1], 0]
297
+ - part: head_half
298
+ package: example_part_cadquery_logo
299
+ name: head_half_2
300
+ location: [[0,0,25], [0,0,1], -90]
301
+ - part: bolt
302
+ package: example_part_step
303
+ location: [[0,0,7.5], [0,0,1], 0]</code>
304
+ </td>
305
+ <td><img src="https://github.com/openvmp/partcad/blob/main/examples/assembly_assy/logo.png?raw=true"></td>
306
+ <tr>
307
+ </table>
308
+
309
+ ### Packages
310
+
311
+ Each project that produces or consumes PartCAD models is a separate PartCAD package.
312
+ Each package may export parts, assemblies and scenes.
313
+ Each package may import parts, assemblies and scenes from its dependencies
314
+ (other PartCAD packages).
315
+
316
+ | Method | Example |
317
+ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
318
+ | Local files<br/>(present in<br/>your own<br/>source code<br/>repository) | import:<br/>&nbsp;&nbsp;other_directory<br/>&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;local<br/>&nbsp;&nbsp;&nbsp;&nbsp;path:&nbsp;../../other |
319
+ | External GIT<br/>repository<br/>(HTTPS, SSH) | import:<br/>&nbsp;&nbsp;other_directory<br/>&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;git<br/>&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;https://github.com/openvmp/partcad |
320
+ | External tar ball<br/>(HTTPS) | import:<br/>&nbsp;&nbsp;other_directory<br/>&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;tar<br/>&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;[https://github.com/openv...090ca.tar.gz](https://github.com/openvmp/partcad/archive/7544a5a1e3d8909c9ecee9e87b30998c05d090ca.tar.gz) |
321
+
322
+ The full syntax is below:
323
+
324
+ ```yaml
325
+ import:
326
+ <package-name>:
327
+ desc: <(optional) textual description>
328
+ type: <git|tar|local>
329
+ path: <(local only) relative-path>
330
+ url: <(git|tar only) url-of-the-package>
331
+ relPath: <(git|tar only) relative-path-within-the-repository>
332
+ web: <(optional) package or maintainer's url>
333
+ poc: <(optional) maintainer's email>
334
+ pythonVersion: <(optional) python version for sandboxing if applicable>
335
+ ```
336
+
337
+ ### Troubleshooting
338
+
339
+ At the moment, the best way to troubleshoot PartCAD is to use VS Code with `OCP CAD Viewer`.
340
+ Any part or assembly can be displayed in `OCP CAD Viewer` by running `pc show <part> [<package>]` or `pc show -a <assembly> [<package>]` in a terminal view.
341
+
342
+ ```sh
343
+ # Create a temporary folder
344
+ mkdir /tmp/test_show && cd /tmp/test_show
345
+
346
+ # Initialize a package with the default dependency on public PartCAD repository
347
+ pc init
348
+
349
+ # Show one of available parts in 'OCP CAD Viewer'
350
+ pc show fastener/screw-buttonhead standard-metric-cqwarehouse
351
+ ```
352
+
353
+ ### Render your project
354
+
355
+ Use `pc render` to render PartCAD parts and assemblies
356
+ in the current package (the current directory).
357
+
358
+ ```sh
359
+ git clone https://github.com/openvmp/partcad-cqwarehouse.git
360
+ cd partcad-cqwarehouse
361
+ pc render
362
+ ```
363
+
364
+ ### Publishing
365
+
366
+ It is very simple to publish your package to the public PartCAD repository.
367
+
368
+ First, you need to publish your own package which defines the models you want to publish.
369
+ Then create a pull request in [the public PartCAD repo](https://github.com/openvmp/partcad) to add a reference to your package.
370
+
371
+ ## Export
372
+
373
+ ### Images
374
+
375
+ Individual parts, assemblies and scenes can be rendered and exported into the
376
+ following formats:
377
+
378
+ - PNG
379
+ - [STEP]
380
+ - [STL](https://en.wikipedia.org/wiki/STL_(file_format))
381
+ - [3MF](https://en.wikipedia.org/wiki/3D_Manufacturing_Format)
382
+ - [ThreeJS](https://en.wikipedia.org/wiki/Three.js)
383
+
384
+ Expect more image formats to be added to the list of supported export formats in the future.
385
+
386
+ ### Purchasing / Bill of materials
387
+
388
+ The bill of materials for each assembly can be produced using the following
389
+ formats:
390
+
391
+ - [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) (not yet / in progress)
392
+ - [Markdown](https://en.wikipedia.org/wiki/Markdown) (not yet / in progress)
393
+
394
+ ## Security
395
+
396
+ PartCAD is capable of rendering scripted parts
397
+ ([CadQuery] and [build123d] use Python) in sandboxed environments.
398
+
399
+ While at the moment it is only useful from dependency management perspective,
400
+ in the future PartCAD aims to achieve security isolation of the sandboxed
401
+ environments. That will fundamentally change the security implications of using
402
+ scripted models shared online.
403
+
404
+ ## Tools for mechanical engineering
405
+
406
+ Here is an overview of the open source tools to maintain
407
+ mechanical projects. It shows where does this framework fit
408
+ in the modern mechanical development workflows.
409
+
410
+ ```mermaid
411
+ flowchart TB
412
+
413
+ subgraph repo["Your project's GIT repository"]
414
+ subgraph custom_repo["Custom parts"]
415
+ direction TB
416
+ custom_part_internet["A STEP file\ndownloaded from Internet\nor the vendor site"]
417
+ custom_part_cad["A part exported as a solid\nfrom a CAD tool not\nsuitable for collaboration"]
418
+ custom_part_cq["An individual reusable part\nmaintained as a script\nunder a version control system"]
419
+ custom_part_os["Another reusable part\nmaintained as a script\nunder a version control system"]
420
+ end
421
+
422
+ model["Your project's model defined\nas ASSY or Python code\nfor version control\nand collaboration"]
423
+
424
+ subgraph scenes["Scenes"]
425
+ test1["Capability 1\ntest scene"]
426
+ test2["Capability 2\ntest scene"]
427
+ end
428
+ end
429
+
430
+ subgraph external_repos["Third-party GIT repositories,\nCDN-hosted files or OCCI servers"]
431
+ subgraph external_repo["Repository of standard\nor popular parts"]
432
+ end
433
+ end
434
+
435
+ subgraph external_tools["External tools"]
436
+ freecad["FreeCAD"]
437
+ cadquery["CadQuery / build123d"]
438
+ openscad["OpenSCAD"]
439
+ gazebo["Gazebo"]
440
+
441
+ partcad["PartCAD library"]
442
+ style partcad fill:#c00
443
+ end
444
+
445
+ custom_part_cad <--- |Individual\ncontributor|freecad
446
+ custom_part_cq <--- |Part design\nworkflow| cadquery
447
+ custom_part_os <--- |Part design\nworkflow| openscad
448
+
449
+ external_repo ---> |Import| model
450
+ custom_repo ---> |Import| model
451
+ model -.-> |Import| test1
452
+ model -.-> |Import| test2
453
+
454
+ custom_repo <-. Maintained\nusing\nPartCAD\nconvention .- partcad
455
+ external_repo <-. Maintained\nusing\nPartCAD\nconvention .- partcad
456
+ model <--- partcad
457
+ test1 <--- partcad
458
+ test2 <--- partcad
459
+
460
+ test1 -.-> |Export| gazebo
461
+ test2 -.-> |Export| gazebo
462
+ ```
463
+
464
+ ## History
465
+
466
+ PartCAD is the evolution of the modelling framework that was once used
467
+ internally in [OpenVMP](https://github.com/openvmp/openvmp-models).
468
+ It is now being maintained separately as a generic tool.
469
+
470
+ The motivation behind this framework is to build a packaging and dependency
471
+ tracking layer on top of both [CadQuery]/[build123d] and traditional CAD tools to
472
+ enable version control and other features required for effective collaboration.
473
+
474
+ This framework currently uses [build123d] and, thus, [OpenCASCADE] under the hood.
475
+ However this may change in the future, if the python C bindings for [OpenCASCADE]
476
+ remain a blocker for unlocking multithreaded performance.
477
+
478
+ [CadQuery]: https://github.com/CadQuery/cadquery
479
+ [build123d]: https://github.com/gumyr/build123d
480
+ [STEP]: https://en.wikipedia.org/wiki/ISO_10303
481
+ [OpenCASCADE]: https://www.opencascade.com/