partcad-cli 0.3.66__tar.gz → 0.3.70__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 (21) hide show
  1. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/PKG-INFO +84 -104
  2. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/README.md +82 -102
  3. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/pyproject.toml +1 -1
  4. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/requirements.txt +1 -1
  5. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/__init__.py +1 -1
  6. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/cli.py +4 -0
  7. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/cli_render.py +31 -6
  8. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli.egg-info/PKG-INFO +84 -104
  9. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli.egg-info/requires.txt +1 -1
  10. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/setup.cfg +0 -0
  11. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/cli_add.py +0 -0
  12. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/cli_init.py +0 -0
  13. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/cli_install.py +0 -0
  14. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/cli_list.py +0 -0
  15. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/cli_show.py +0 -0
  16. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/template/init-private.yaml +0 -0
  17. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli/template/init-public.yaml +0 -0
  18. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli.egg-info/SOURCES.txt +0 -0
  19. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli.egg-info/dependency_links.txt +0 -0
  20. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli.egg-info/entry_points.txt +0 -0
  21. {partcad-cli-0.3.66 → partcad-cli-0.3.70}/src/partcad_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: partcad-cli
3
- Version: 0.3.66
3
+ Version: 0.3.70
4
4
  Summary: Command-line interface to PartCAD
5
5
  Author-email: Roman Kuzmenko <openvmp@proton.me>
6
6
  Maintainer-email: Roman Kuzmenko <openvmp@proton.me>
@@ -12,7 +12,7 @@ Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Requires-Python: >=3.9
14
14
  Description-Content-Type: text/markdown
15
- Requires-Dist: partcad==0.3.66
15
+ Requires-Dist: partcad==0.3.70
16
16
  Requires-Dist: pycairo
17
17
  Requires-Dist: renderlab
18
18
  Requires-Dist: rlPyCairo
@@ -27,6 +27,7 @@ Requires-Dist: progress
27
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
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
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
+ [![Documentation Status](https://readthedocs.org/projects/partcad/badge/?version=latest)](https://partcad.readthedocs.io/en/latest/?badge=latest)
30
31
 
31
32
  PartCAD is the first package manager for CAD models,
32
33
  and a Python package to consume these packages in CAD scripts ([`cadquery`][CadQuery] and [`build123d`][build123d]).
@@ -45,18 +46,19 @@ and to reuse the same parts in multiple assemblies, multiple projects.
45
46
  The implementation of parts can change over time
46
47
  (e.g. optimize or migrate to [CadQuery] from [STEP]) without the need to update
47
48
  all of the consumers.
49
+ Find more documentation [here](https://partcad.readthedocs.io/en/latest/?badge=latest).
48
50
 
49
51
  - [Installation](#installation)
50
52
  - [Browse models published to PartCAD](#browse-models-published-to-partcad)
51
53
  - [Consume PartCAD models](#consume-partcad-models)
52
- - [Create PartCAD models](#create-partcad-models)
54
+ - [Publish PartCAD models](#publish-partcad-models)
53
55
  - [Parts](#parts)
54
56
  - [Assemblies](#assemblies)
55
57
  - [Packages](#packages)
56
58
  - [Troubleshooting](#troubleshooting)
57
59
  - [Render your project](#render-your-project)
58
60
  - [Publishing](#publishing)
59
- - [Export](#export)
61
+ - [Export PartCAD models](#export-partcad-models)
60
62
  - [Images](#images)
61
63
  - [Purchasing / Bill of materials](#purchasing--bill-of-materials)
62
64
  - [Security](#security)
@@ -111,41 +113,43 @@ Alternatively, manually create `partcad.yaml` with the following content:
111
113
  ```yaml
112
114
  # partcad.yaml
113
115
  import:
114
- partcad-index: # Standard public PartCAD repository (needs to be explicitly referenced to be used)
116
+ # Public PartCAD repository (reference it explicitly if required)
117
+ partcad-index:
115
118
  type: git
116
119
  url: https://github.com/openvmp/partcad-index.git
117
120
  ```
118
121
 
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:
122
+ After this, all models in the public PartCAD repository are ready to be consumed.
123
+ If you want to use these models in a CAD Design GUI (like FreeCAD or its paid
124
+ alternatives), the best way to do it at the moment (before PartCAD plugins for
125
+ these apps are available) is to export the models to STEP or 3MF files and,
126
+ then, import them into the CAD Design GUI of your choice.
121
127
 
122
- <table>
123
- <tr>
124
- <td>
125
- <code># CadQuery
128
+ ```shell
129
+ # Some "export to a file" examples:
130
+ $ pc render -p -t stl <part> [<package>]
131
+ $ pc render -p -t step -a <assembly> [<package>]
132
+ ```
133
+
134
+ If you want to use these models in a CAD-as-code framework, find below the
135
+ example how to do it in CadQuery. More examples are
136
+ [also available](./examples/README.md).
137
+
138
+ ```python
139
+ # Example: Consume PartCAD models in CadQuery
126
140
  import cadquery as cq
127
141
  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
142
  ...
135
- show_object(part)</code>
136
- </td>
137
- <td>
138
- <code># build123d
139
- import build123d as b3d
140
- import partcad as pc
141
143
  part = pc.get_part(
142
144
  # Part name
143
145
  "fastener/screw-buttonhead",
144
146
  # Package name
145
147
  "standard-metric-cqwarehouse",
146
- ).get_build123d()
148
+ ).get_cadquery()
147
149
  ...
148
- show_object(part)</code>
150
+ show_object(part)
151
+ ```
152
+
149
153
  </td>
150
154
  <!--
151
155
  <td>
@@ -165,10 +169,11 @@ pc.finalize(part)</code>
165
169
  </table>
166
170
 
167
171
 
168
- ## Create PartCAD models
172
+ ## Publish PartCAD models
169
173
 
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.
174
+ Each project that produces or consumes PartCAD models is a separate PartCAD package.
175
+ Each package may export parts, assemblies and scenes.
176
+ A package is defined by `partcad.yaml`.
172
177
 
173
178
  ### Parts
174
179
 
@@ -181,86 +186,52 @@ PartCAD allows to define parts using any of the following methods:
181
186
  <th>Result</td>
182
187
  </tr>
183
188
  <tr>
184
- <td><a href="https://github.com/CadQuery/cadquery">CadQuery</a></td>
189
+ <td>Python scripts:<br/><a href="https://github.com/CadQuery/cadquery">CadQuery</a>,<br/><a href="https://github.com/gumyr/build123d">build123d</a></td>
185
190
  <td>
186
- <code># partcad.yaml
187
- parts:
188
- cube:
189
- type: cadquery</code>
191
+ Place the following in "partcad.yaml":<br/>
192
+ <code>parts:<br/>
193
+ &nbsp;&nbsp;&nbsp;&nbsp;src/cylinder:<br/>
194
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: cadquery<br/>
195
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: build123d</code>
190
196
  <br/>
191
197
  <br/>
192
- Place the CadQuery script in "cube.py"
198
+ Place the script in "src/cylinder.py".
193
199
  </td>
194
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_cadquery_primitive/cube.png?raw=true"></td>
200
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_cadquery_primitive/cylinder.svg?raw=true" /></td>
195
201
  </tr>
196
202
  <tr>
197
- <td><a href="https://github.com/gumyr/build123d">build123d</a></td>
203
+ <td>CAD files:<br/><a href="https://en.wikipedia.org/wiki/ISO_10303">STEP</a>,<br/>
204
+ <a href="https://en.wikipedia.org/wiki/STL_(file_format)">STL</a>,<br/>
205
+ <a href="https://en.wikipedia.org/wiki/3D_Manufacturing_Format">3MF</a></td>
198
206
  <td>
199
- <code># partcad.yaml
200
- parts:
201
- cube:
202
- type: build123d</code>
207
+ Place the following in "partcad.yaml":<br/>
208
+ <code>parts:<br/>
209
+ &nbsp;&nbsp;&nbsp;&nbsp;screw:<br/>
210
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: step<br/>
211
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: stl<br/>
212
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: 3mf</code>
203
213
 
204
214
  <br/>
205
- Place the build123d script in "cube.py"
215
+ Store the model in "screw.step", "screw.stl" or "screw.3mf" respectively.
206
216
  </td>
207
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_cadquery_primitive/cube.png?raw=true"></td>
217
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_step/bolt.svg?raw=true"/></td>
208
218
  </tr>
209
219
  <tr>
210
- <td><a href="https://en.wikipedia.org/wiki/ISO_10303">STEP</a></td>
220
+ <td>CAD scripts:<br/><a href="https://en.wikipedia.org/wiki/OpenSCAD">OpenSCAD</a></td>
211
221
  <td>
212
- <code># partcad.yaml
213
- parts:
214
- bolt:
215
- type: step</code>
222
+ Place the following in "partcad.yaml":<br/>
223
+ <code>parts:<br/>
224
+ &nbsp;&nbsp;&nbsp;&nbsp;cube:<br/>
225
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: scad</code>
216
226
 
217
227
  <br/>
218
- Store the model in "bolt.step"
228
+ Store the model in "cube.scad".
219
229
  </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>
230
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_scad/cube.svg?raw=true" /></td>
260
231
  </tr>
261
232
  </table>
262
233
 
263
- Other methods to define parts are coming in soon (e.g. SCAD).
234
+ Other methods to define parts are coming soon (e.g. [SDF](https://github.com/fogleman/sdf)).
264
235
 
265
236
  ### Assemblies
266
237
 
@@ -302,22 +273,20 @@ links:
302
273
  package: example_part_step
303
274
  location: [[0,0,7.5], [0,0,1], 0]</code>
304
275
  </td>
305
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/assembly_assy/logo.png?raw=true"></td>
276
+ <td><img width=256 src="https://github.com/openvmp/partcad/blob/main/examples/produce_assembly_assy/logo.svg?raw=true" /></td>
306
277
  <tr>
307
278
  </table>
308
279
 
309
280
  ### Packages
310
281
 
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).
282
+ PartCAD packages may import parts, assemblies and scenes from its dependencies
283
+ (other PartCAD packages). There are several methods to import other packages:
315
284
 
316
285
  | Method | Example |
317
286
  | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
318
287
  | 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) |
288
+ | 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 |
289
+ | Hosted 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
290
 
322
291
  The full syntax is below:
323
292
 
@@ -326,9 +295,10 @@ import:
326
295
  <package-name>:
327
296
  desc: <(optional) textual description>
328
297
  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>
298
+ path: <(local only) relative path>
299
+ url: <(git|tar only) url of the package>
300
+ relPath: <(git|tar only) relative path within the repository>
301
+ revision: <(git only) the exact revision to import>
332
302
  web: <(optional) package or maintainer's url>
333
303
  poc: <(optional) maintainer's email>
334
304
  pythonVersion: <(optional) python version for sandboxing if applicable>
@@ -346,7 +316,7 @@ mkdir /tmp/test_show && cd /tmp/test_show
346
316
  # Initialize a package with the default dependency on public PartCAD repository
347
317
  pc init
348
318
 
349
- # Show one of available parts in 'OCP CAD Viewer'
319
+ # Show the part in 'OCP CAD Viewer'
350
320
  pc show fastener/screw-buttonhead standard-metric-cqwarehouse
351
321
  ```
352
322
 
@@ -361,25 +331,35 @@ cd partcad-cqwarehouse
361
331
  pc render
362
332
  ```
363
333
 
364
- ### Publishing
334
+ See [an example](./examples/feature_export/) how to configure package's
335
+ rendering settings.
365
336
 
366
- It is very simple to publish your package to the public PartCAD repository.
337
+ ### Publishing
367
338
 
368
- First, you need to publish your own package which defines the models you want to publish.
339
+ It's very simple to publish your package to the public PartCAD repository.
340
+ First, publish your package (e.g. as a repo on GitHub).
369
341
  Then create a pull request in [the public PartCAD repo](https://github.com/openvmp/partcad) to add a reference to your package.
370
342
 
371
- ## Export
343
+ ## Export PartCAD models
372
344
 
373
345
  ### Images
374
346
 
375
347
  Individual parts, assemblies and scenes can be rendered and exported into the
376
348
  following formats:
377
349
 
350
+ - SVG
378
351
  - PNG
379
352
  - [STEP]
380
353
  - [STL](https://en.wikipedia.org/wiki/STL_(file_format))
381
354
  - [3MF](https://en.wikipedia.org/wiki/3D_Manufacturing_Format)
382
355
  - [ThreeJS](https://en.wikipedia.org/wiki/Three.js)
356
+ - [OBJ](https://en.wikipedia.org/wiki/Wavefront_.obj_file)
357
+
358
+ ```shell
359
+ # Some "export to a file" examples:
360
+ $ pc render -p -t stl <part> [<package>]
361
+ $ pc render -p -t step -a <assembly> [<package>]
362
+ ```
383
363
 
384
364
  Expect more image formats to be added to the list of supported export formats in the future.
385
365
 
@@ -5,6 +5,7 @@
5
5
  [![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)
6
6
  [![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)
7
7
  [![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)
8
+ [![Documentation Status](https://readthedocs.org/projects/partcad/badge/?version=latest)](https://partcad.readthedocs.io/en/latest/?badge=latest)
8
9
 
9
10
  PartCAD is the first package manager for CAD models,
10
11
  and a Python package to consume these packages in CAD scripts ([`cadquery`][CadQuery] and [`build123d`][build123d]).
@@ -23,18 +24,19 @@ and to reuse the same parts in multiple assemblies, multiple projects.
23
24
  The implementation of parts can change over time
24
25
  (e.g. optimize or migrate to [CadQuery] from [STEP]) without the need to update
25
26
  all of the consumers.
27
+ Find more documentation [here](https://partcad.readthedocs.io/en/latest/?badge=latest).
26
28
 
27
29
  - [Installation](#installation)
28
30
  - [Browse models published to PartCAD](#browse-models-published-to-partcad)
29
31
  - [Consume PartCAD models](#consume-partcad-models)
30
- - [Create PartCAD models](#create-partcad-models)
32
+ - [Publish PartCAD models](#publish-partcad-models)
31
33
  - [Parts](#parts)
32
34
  - [Assemblies](#assemblies)
33
35
  - [Packages](#packages)
34
36
  - [Troubleshooting](#troubleshooting)
35
37
  - [Render your project](#render-your-project)
36
38
  - [Publishing](#publishing)
37
- - [Export](#export)
39
+ - [Export PartCAD models](#export-partcad-models)
38
40
  - [Images](#images)
39
41
  - [Purchasing / Bill of materials](#purchasing--bill-of-materials)
40
42
  - [Security](#security)
@@ -89,41 +91,43 @@ Alternatively, manually create `partcad.yaml` with the following content:
89
91
  ```yaml
90
92
  # partcad.yaml
91
93
  import:
92
- partcad-index: # Standard public PartCAD repository (needs to be explicitly referenced to be used)
94
+ # Public PartCAD repository (reference it explicitly if required)
95
+ partcad-index:
93
96
  type: git
94
97
  url: https://github.com/openvmp/partcad-index.git
95
98
  ```
96
99
 
97
- After this, PartCAD python module can be used to retrieve any model.
98
- The exact way to do this depends on the CAD framework used in your project:
100
+ After this, all models in the public PartCAD repository are ready to be consumed.
101
+ If you want to use these models in a CAD Design GUI (like FreeCAD or its paid
102
+ alternatives), the best way to do it at the moment (before PartCAD plugins for
103
+ these apps are available) is to export the models to STEP or 3MF files and,
104
+ then, import them into the CAD Design GUI of your choice.
99
105
 
100
- <table>
101
- <tr>
102
- <td>
103
- <code># CadQuery
106
+ ```shell
107
+ # Some "export to a file" examples:
108
+ $ pc render -p -t stl <part> [<package>]
109
+ $ pc render -p -t step -a <assembly> [<package>]
110
+ ```
111
+
112
+ If you want to use these models in a CAD-as-code framework, find below the
113
+ example how to do it in CadQuery. More examples are
114
+ [also available](./examples/README.md).
115
+
116
+ ```python
117
+ # Example: Consume PartCAD models in CadQuery
104
118
  import cadquery as cq
105
119
  import partcad as pc
106
- part = pc.get_part(
107
- # Part name
108
- "fastener/screw-buttonhead",
109
- # Package name
110
- "standard-metric-cqwarehouse",
111
- ).get_cadquery()
112
120
  ...
113
- show_object(part)</code>
114
- </td>
115
- <td>
116
- <code># build123d
117
- import build123d as b3d
118
- import partcad as pc
119
121
  part = pc.get_part(
120
122
  # Part name
121
123
  "fastener/screw-buttonhead",
122
124
  # Package name
123
125
  "standard-metric-cqwarehouse",
124
- ).get_build123d()
126
+ ).get_cadquery()
125
127
  ...
126
- show_object(part)</code>
128
+ show_object(part)
129
+ ```
130
+
127
131
  </td>
128
132
  <!--
129
133
  <td>
@@ -143,10 +147,11 @@ pc.finalize(part)</code>
143
147
  </table>
144
148
 
145
149
 
146
- ## Create PartCAD models
150
+ ## Publish PartCAD models
147
151
 
148
- This frameworks allows to create large models and scenes, one part at a time,
149
- while having parts and assemblies often maintained by third parties.
152
+ Each project that produces or consumes PartCAD models is a separate PartCAD package.
153
+ Each package may export parts, assemblies and scenes.
154
+ A package is defined by `partcad.yaml`.
150
155
 
151
156
  ### Parts
152
157
 
@@ -159,86 +164,52 @@ PartCAD allows to define parts using any of the following methods:
159
164
  <th>Result</td>
160
165
  </tr>
161
166
  <tr>
162
- <td><a href="https://github.com/CadQuery/cadquery">CadQuery</a></td>
167
+ <td>Python scripts:<br/><a href="https://github.com/CadQuery/cadquery">CadQuery</a>,<br/><a href="https://github.com/gumyr/build123d">build123d</a></td>
163
168
  <td>
164
- <code># partcad.yaml
165
- parts:
166
- cube:
167
- type: cadquery</code>
169
+ Place the following in "partcad.yaml":<br/>
170
+ <code>parts:<br/>
171
+ &nbsp;&nbsp;&nbsp;&nbsp;src/cylinder:<br/>
172
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: cadquery<br/>
173
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: build123d</code>
168
174
  <br/>
169
175
  <br/>
170
- Place the CadQuery script in "cube.py"
176
+ Place the script in "src/cylinder.py".
171
177
  </td>
172
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_cadquery_primitive/cube.png?raw=true"></td>
178
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_cadquery_primitive/cylinder.svg?raw=true" /></td>
173
179
  </tr>
174
180
  <tr>
175
- <td><a href="https://github.com/gumyr/build123d">build123d</a></td>
181
+ <td>CAD files:<br/><a href="https://en.wikipedia.org/wiki/ISO_10303">STEP</a>,<br/>
182
+ <a href="https://en.wikipedia.org/wiki/STL_(file_format)">STL</a>,<br/>
183
+ <a href="https://en.wikipedia.org/wiki/3D_Manufacturing_Format">3MF</a></td>
176
184
  <td>
177
- <code># partcad.yaml
178
- parts:
179
- cube:
180
- type: build123d</code>
185
+ Place the following in "partcad.yaml":<br/>
186
+ <code>parts:<br/>
187
+ &nbsp;&nbsp;&nbsp;&nbsp;screw:<br/>
188
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: step<br/>
189
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: stl<br/>
190
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: 3mf</code>
181
191
 
182
192
  <br/>
183
- Place the build123d script in "cube.py"
193
+ Store the model in "screw.step", "screw.stl" or "screw.3mf" respectively.
184
194
  </td>
185
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_cadquery_primitive/cube.png?raw=true"></td>
195
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_step/bolt.svg?raw=true"/></td>
186
196
  </tr>
187
197
  <tr>
188
- <td><a href="https://en.wikipedia.org/wiki/ISO_10303">STEP</a></td>
198
+ <td>CAD scripts:<br/><a href="https://en.wikipedia.org/wiki/OpenSCAD">OpenSCAD</a></td>
189
199
  <td>
190
- <code># partcad.yaml
191
- parts:
192
- bolt:
193
- type: step</code>
200
+ Place the following in "partcad.yaml":<br/>
201
+ <code>parts:<br/>
202
+ &nbsp;&nbsp;&nbsp;&nbsp;cube:<br/>
203
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: scad</code>
194
204
 
195
205
  <br/>
196
- Store the model in "bolt.step"
206
+ Store the model in "cube.scad".
197
207
  </td>
198
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_step/bolt.png?raw=true"></td>
199
- </tr>
200
- <tr>
201
- <td><a href="https://en.wikipedia.org/wiki/STL_(file_format)">STL</a></td>
202
- <td>
203
- <code># partcad.yaml
204
- parts:
205
- cube:
206
- type: stl</code>
207
-
208
- <br/>
209
- Store the model in "cube.stl"
210
- </td>
211
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_stl/cube.png?raw=true"></td>
212
- </tr>
213
- <tr>
214
- <td><a href="https://en.wikipedia.org/wiki/3D_Manufacturing_Format">3MF</a></td>
215
- <td>
216
- <code># partcad.yaml
217
- parts:
218
- cube:
219
- type: 3mf</code>
220
-
221
- <br/>
222
- Store the model in "cube.3mf"
223
- </td>
224
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_3mf/cube.png?raw=true"></td>
225
- </tr>
226
- <tr>
227
- <td><a href="https://en.wikipedia.org/wiki/OpenSCAD">OpenSCAD</a></td>
228
- <td>
229
- <code># partcad.yaml
230
- parts:
231
- cube:
232
- type: scad</code>
233
-
234
- <br/>
235
- Store the model in "cube.scad"
236
- </td>
237
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_scad/cube.png?raw=true"></td>
208
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_scad/cube.svg?raw=true" /></td>
238
209
  </tr>
239
210
  </table>
240
211
 
241
- Other methods to define parts are coming in soon (e.g. SCAD).
212
+ Other methods to define parts are coming soon (e.g. [SDF](https://github.com/fogleman/sdf)).
242
213
 
243
214
  ### Assemblies
244
215
 
@@ -280,22 +251,20 @@ links:
280
251
  package: example_part_step
281
252
  location: [[0,0,7.5], [0,0,1], 0]</code>
282
253
  </td>
283
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/assembly_assy/logo.png?raw=true"></td>
254
+ <td><img width=256 src="https://github.com/openvmp/partcad/blob/main/examples/produce_assembly_assy/logo.svg?raw=true" /></td>
284
255
  <tr>
285
256
  </table>
286
257
 
287
258
  ### Packages
288
259
 
289
- Each project that produces or consumes PartCAD models is a separate PartCAD package.
290
- Each package may export parts, assemblies and scenes.
291
- Each package may import parts, assemblies and scenes from its dependencies
292
- (other PartCAD packages).
260
+ PartCAD packages may import parts, assemblies and scenes from its dependencies
261
+ (other PartCAD packages). There are several methods to import other packages:
293
262
 
294
263
  | Method | Example |
295
264
  | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
296
265
  | 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 |
297
- | 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 |
298
- | 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) |
266
+ | 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 |
267
+ | Hosted 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) |
299
268
 
300
269
  The full syntax is below:
301
270
 
@@ -304,9 +273,10 @@ import:
304
273
  <package-name>:
305
274
  desc: <(optional) textual description>
306
275
  type: <git|tar|local>
307
- path: <(local only) relative-path>
308
- url: <(git|tar only) url-of-the-package>
309
- relPath: <(git|tar only) relative-path-within-the-repository>
276
+ path: <(local only) relative path>
277
+ url: <(git|tar only) url of the package>
278
+ relPath: <(git|tar only) relative path within the repository>
279
+ revision: <(git only) the exact revision to import>
310
280
  web: <(optional) package or maintainer's url>
311
281
  poc: <(optional) maintainer's email>
312
282
  pythonVersion: <(optional) python version for sandboxing if applicable>
@@ -324,7 +294,7 @@ mkdir /tmp/test_show && cd /tmp/test_show
324
294
  # Initialize a package with the default dependency on public PartCAD repository
325
295
  pc init
326
296
 
327
- # Show one of available parts in 'OCP CAD Viewer'
297
+ # Show the part in 'OCP CAD Viewer'
328
298
  pc show fastener/screw-buttonhead standard-metric-cqwarehouse
329
299
  ```
330
300
 
@@ -339,25 +309,35 @@ cd partcad-cqwarehouse
339
309
  pc render
340
310
  ```
341
311
 
342
- ### Publishing
312
+ See [an example](./examples/feature_export/) how to configure package's
313
+ rendering settings.
343
314
 
344
- It is very simple to publish your package to the public PartCAD repository.
315
+ ### Publishing
345
316
 
346
- First, you need to publish your own package which defines the models you want to publish.
317
+ It's very simple to publish your package to the public PartCAD repository.
318
+ First, publish your package (e.g. as a repo on GitHub).
347
319
  Then create a pull request in [the public PartCAD repo](https://github.com/openvmp/partcad) to add a reference to your package.
348
320
 
349
- ## Export
321
+ ## Export PartCAD models
350
322
 
351
323
  ### Images
352
324
 
353
325
  Individual parts, assemblies and scenes can be rendered and exported into the
354
326
  following formats:
355
327
 
328
+ - SVG
356
329
  - PNG
357
330
  - [STEP]
358
331
  - [STL](https://en.wikipedia.org/wiki/STL_(file_format))
359
332
  - [3MF](https://en.wikipedia.org/wiki/3D_Manufacturing_Format)
360
333
  - [ThreeJS](https://en.wikipedia.org/wiki/Three.js)
334
+ - [OBJ](https://en.wikipedia.org/wiki/Wavefront_.obj_file)
335
+
336
+ ```shell
337
+ # Some "export to a file" examples:
338
+ $ pc render -p -t stl <part> [<package>]
339
+ $ pc render -p -t step -a <assembly> [<package>]
340
+ ```
361
341
 
362
342
  Expect more image formats to be added to the list of supported export formats in the future.
363
343
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "partcad-cli"
3
- version = "0.3.66"
3
+ version = "0.3.70"
4
4
  description = "Command-line interface to PartCAD"
5
5
  readme = "README.md"
6
6
  keywords = ["cadquery", "build123d", "cad", "design", "openscad", "step", "stl"]
@@ -1,4 +1,4 @@
1
- partcad==0.3.66
1
+ partcad==0.3.70
2
2
  pycairo
3
3
  renderlab
4
4
  rlPyCairo
@@ -4,4 +4,4 @@ __all__ = [
4
4
  "main_cli",
5
5
  ]
6
6
 
7
- __version__: str = "0.3.66"
7
+ __version__: str = "0.3.70"
@@ -21,6 +21,10 @@ from .cli_render import *
21
21
  from .cli_show import *
22
22
 
23
23
 
24
+ # Initialize plugins that are not enabled by default
25
+ pc.plugins.export_png = pc.PluginExportPngReportlab()
26
+
27
+
24
28
  def main():
25
29
  parser = argparse.ArgumentParser(
26
30
  description="PartCAD command line tool",
@@ -17,6 +17,28 @@ def cli_help_render(subparsers: argparse.ArgumentParser):
17
17
  "render",
18
18
  help="Render the selected or all parts, assemblies and scenes in this package",
19
19
  )
20
+ parser_render.add_argument(
21
+ "-p",
22
+ help="Create the neccessary directory structure if it is missing",
23
+ dest="create_dirs",
24
+ action="store_true",
25
+ )
26
+ parser_render.add_argument(
27
+ "-O",
28
+ help="Create artifacts in the given output directory",
29
+ dest="output_dir",
30
+ type=str,
31
+ nargs="?",
32
+ )
33
+ parser_render.add_argument(
34
+ "-t",
35
+ help="The object is an assembly",
36
+ dest="format",
37
+ type=str,
38
+ nargs="?",
39
+ choices=["svg", "png", "step", "stl", "3mf", "threejs", "obj"],
40
+ )
41
+
20
42
  group_type = parser_render.add_mutually_exclusive_group(required=False)
21
43
  group_type.add_argument(
22
44
  "-a",
@@ -37,10 +59,6 @@ def cli_help_render(subparsers: argparse.ArgumentParser):
37
59
  type=str,
38
60
  nargs="?",
39
61
  )
40
- # TODO(clairbee): make the package argument depending on the object argument
41
- # [<object> [<package>]]
42
- # instead of
43
- # [<object>] [<package>]
44
62
  parser_render.add_argument(
45
63
  "package",
46
64
  help="Package to retrieve the object from",
@@ -55,6 +73,8 @@ def cli_render(args):
55
73
  else:
56
74
  ctx = pc.init()
57
75
 
76
+ ctx.option_create_dirs = args.create_dirs
77
+
58
78
  if args.package is None:
59
79
  package = "this"
60
80
  else:
@@ -62,7 +82,7 @@ def cli_render(args):
62
82
 
63
83
  if args.object is None:
64
84
  # Render all parts and assemblies configured to be auto-rendered in this project
65
- ctx.render()
85
+ ctx.render(format=args.format, output_dir=args.output_dir)
66
86
  else:
67
87
  # Render the requested part or assembly
68
88
  parts = []
@@ -73,4 +93,9 @@ def cli_render(args):
73
93
  parts.append(args.object)
74
94
 
75
95
  prj = ctx.get_project(package)
76
- prj.render(parts=parts, assemblies=assemblies)
96
+ prj.render(
97
+ parts=parts,
98
+ assemblies=assemblies,
99
+ format=args.format,
100
+ output_dir=args.output_dir,
101
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: partcad-cli
3
- Version: 0.3.66
3
+ Version: 0.3.70
4
4
  Summary: Command-line interface to PartCAD
5
5
  Author-email: Roman Kuzmenko <openvmp@proton.me>
6
6
  Maintainer-email: Roman Kuzmenko <openvmp@proton.me>
@@ -12,7 +12,7 @@ Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Operating System :: OS Independent
13
13
  Requires-Python: >=3.9
14
14
  Description-Content-Type: text/markdown
15
- Requires-Dist: partcad==0.3.66
15
+ Requires-Dist: partcad==0.3.70
16
16
  Requires-Dist: pycairo
17
17
  Requires-Dist: renderlab
18
18
  Requires-Dist: rlPyCairo
@@ -27,6 +27,7 @@ Requires-Dist: progress
27
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
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
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
+ [![Documentation Status](https://readthedocs.org/projects/partcad/badge/?version=latest)](https://partcad.readthedocs.io/en/latest/?badge=latest)
30
31
 
31
32
  PartCAD is the first package manager for CAD models,
32
33
  and a Python package to consume these packages in CAD scripts ([`cadquery`][CadQuery] and [`build123d`][build123d]).
@@ -45,18 +46,19 @@ and to reuse the same parts in multiple assemblies, multiple projects.
45
46
  The implementation of parts can change over time
46
47
  (e.g. optimize or migrate to [CadQuery] from [STEP]) without the need to update
47
48
  all of the consumers.
49
+ Find more documentation [here](https://partcad.readthedocs.io/en/latest/?badge=latest).
48
50
 
49
51
  - [Installation](#installation)
50
52
  - [Browse models published to PartCAD](#browse-models-published-to-partcad)
51
53
  - [Consume PartCAD models](#consume-partcad-models)
52
- - [Create PartCAD models](#create-partcad-models)
54
+ - [Publish PartCAD models](#publish-partcad-models)
53
55
  - [Parts](#parts)
54
56
  - [Assemblies](#assemblies)
55
57
  - [Packages](#packages)
56
58
  - [Troubleshooting](#troubleshooting)
57
59
  - [Render your project](#render-your-project)
58
60
  - [Publishing](#publishing)
59
- - [Export](#export)
61
+ - [Export PartCAD models](#export-partcad-models)
60
62
  - [Images](#images)
61
63
  - [Purchasing / Bill of materials](#purchasing--bill-of-materials)
62
64
  - [Security](#security)
@@ -111,41 +113,43 @@ Alternatively, manually create `partcad.yaml` with the following content:
111
113
  ```yaml
112
114
  # partcad.yaml
113
115
  import:
114
- partcad-index: # Standard public PartCAD repository (needs to be explicitly referenced to be used)
116
+ # Public PartCAD repository (reference it explicitly if required)
117
+ partcad-index:
115
118
  type: git
116
119
  url: https://github.com/openvmp/partcad-index.git
117
120
  ```
118
121
 
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:
122
+ After this, all models in the public PartCAD repository are ready to be consumed.
123
+ If you want to use these models in a CAD Design GUI (like FreeCAD or its paid
124
+ alternatives), the best way to do it at the moment (before PartCAD plugins for
125
+ these apps are available) is to export the models to STEP or 3MF files and,
126
+ then, import them into the CAD Design GUI of your choice.
121
127
 
122
- <table>
123
- <tr>
124
- <td>
125
- <code># CadQuery
128
+ ```shell
129
+ # Some "export to a file" examples:
130
+ $ pc render -p -t stl <part> [<package>]
131
+ $ pc render -p -t step -a <assembly> [<package>]
132
+ ```
133
+
134
+ If you want to use these models in a CAD-as-code framework, find below the
135
+ example how to do it in CadQuery. More examples are
136
+ [also available](./examples/README.md).
137
+
138
+ ```python
139
+ # Example: Consume PartCAD models in CadQuery
126
140
  import cadquery as cq
127
141
  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
142
  ...
135
- show_object(part)</code>
136
- </td>
137
- <td>
138
- <code># build123d
139
- import build123d as b3d
140
- import partcad as pc
141
143
  part = pc.get_part(
142
144
  # Part name
143
145
  "fastener/screw-buttonhead",
144
146
  # Package name
145
147
  "standard-metric-cqwarehouse",
146
- ).get_build123d()
148
+ ).get_cadquery()
147
149
  ...
148
- show_object(part)</code>
150
+ show_object(part)
151
+ ```
152
+
149
153
  </td>
150
154
  <!--
151
155
  <td>
@@ -165,10 +169,11 @@ pc.finalize(part)</code>
165
169
  </table>
166
170
 
167
171
 
168
- ## Create PartCAD models
172
+ ## Publish PartCAD models
169
173
 
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.
174
+ Each project that produces or consumes PartCAD models is a separate PartCAD package.
175
+ Each package may export parts, assemblies and scenes.
176
+ A package is defined by `partcad.yaml`.
172
177
 
173
178
  ### Parts
174
179
 
@@ -181,86 +186,52 @@ PartCAD allows to define parts using any of the following methods:
181
186
  <th>Result</td>
182
187
  </tr>
183
188
  <tr>
184
- <td><a href="https://github.com/CadQuery/cadquery">CadQuery</a></td>
189
+ <td>Python scripts:<br/><a href="https://github.com/CadQuery/cadquery">CadQuery</a>,<br/><a href="https://github.com/gumyr/build123d">build123d</a></td>
185
190
  <td>
186
- <code># partcad.yaml
187
- parts:
188
- cube:
189
- type: cadquery</code>
191
+ Place the following in "partcad.yaml":<br/>
192
+ <code>parts:<br/>
193
+ &nbsp;&nbsp;&nbsp;&nbsp;src/cylinder:<br/>
194
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: cadquery<br/>
195
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: build123d</code>
190
196
  <br/>
191
197
  <br/>
192
- Place the CadQuery script in "cube.py"
198
+ Place the script in "src/cylinder.py".
193
199
  </td>
194
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_cadquery_primitive/cube.png?raw=true"></td>
200
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_cadquery_primitive/cylinder.svg?raw=true" /></td>
195
201
  </tr>
196
202
  <tr>
197
- <td><a href="https://github.com/gumyr/build123d">build123d</a></td>
203
+ <td>CAD files:<br/><a href="https://en.wikipedia.org/wiki/ISO_10303">STEP</a>,<br/>
204
+ <a href="https://en.wikipedia.org/wiki/STL_(file_format)">STL</a>,<br/>
205
+ <a href="https://en.wikipedia.org/wiki/3D_Manufacturing_Format">3MF</a></td>
198
206
  <td>
199
- <code># partcad.yaml
200
- parts:
201
- cube:
202
- type: build123d</code>
207
+ Place the following in "partcad.yaml":<br/>
208
+ <code>parts:<br/>
209
+ &nbsp;&nbsp;&nbsp;&nbsp;screw:<br/>
210
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: step<br/>
211
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: stl<br/>
212
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# type: 3mf</code>
203
213
 
204
214
  <br/>
205
- Place the build123d script in "cube.py"
215
+ Store the model in "screw.step", "screw.stl" or "screw.3mf" respectively.
206
216
  </td>
207
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/part_cadquery_primitive/cube.png?raw=true"></td>
217
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_step/bolt.svg?raw=true"/></td>
208
218
  </tr>
209
219
  <tr>
210
- <td><a href="https://en.wikipedia.org/wiki/ISO_10303">STEP</a></td>
220
+ <td>CAD scripts:<br/><a href="https://en.wikipedia.org/wiki/OpenSCAD">OpenSCAD</a></td>
211
221
  <td>
212
- <code># partcad.yaml
213
- parts:
214
- bolt:
215
- type: step</code>
222
+ Place the following in "partcad.yaml":<br/>
223
+ <code>parts:<br/>
224
+ &nbsp;&nbsp;&nbsp;&nbsp;cube:<br/>
225
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: scad</code>
216
226
 
217
227
  <br/>
218
- Store the model in "bolt.step"
228
+ Store the model in "cube.scad".
219
229
  </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>
230
+ <td><img width=128 src="https://github.com/openvmp/partcad/blob/main/examples/produce_part_scad/cube.svg?raw=true" /></td>
260
231
  </tr>
261
232
  </table>
262
233
 
263
- Other methods to define parts are coming in soon (e.g. SCAD).
234
+ Other methods to define parts are coming soon (e.g. [SDF](https://github.com/fogleman/sdf)).
264
235
 
265
236
  ### Assemblies
266
237
 
@@ -302,22 +273,20 @@ links:
302
273
  package: example_part_step
303
274
  location: [[0,0,7.5], [0,0,1], 0]</code>
304
275
  </td>
305
- <td><img src="https://github.com/openvmp/partcad/blob/main/examples/assembly_assy/logo.png?raw=true"></td>
276
+ <td><img width=256 src="https://github.com/openvmp/partcad/blob/main/examples/produce_assembly_assy/logo.svg?raw=true" /></td>
306
277
  <tr>
307
278
  </table>
308
279
 
309
280
  ### Packages
310
281
 
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).
282
+ PartCAD packages may import parts, assemblies and scenes from its dependencies
283
+ (other PartCAD packages). There are several methods to import other packages:
315
284
 
316
285
  | Method | Example |
317
286
  | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
318
287
  | 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) |
288
+ | 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 |
289
+ | Hosted 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
290
 
322
291
  The full syntax is below:
323
292
 
@@ -326,9 +295,10 @@ import:
326
295
  <package-name>:
327
296
  desc: <(optional) textual description>
328
297
  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>
298
+ path: <(local only) relative path>
299
+ url: <(git|tar only) url of the package>
300
+ relPath: <(git|tar only) relative path within the repository>
301
+ revision: <(git only) the exact revision to import>
332
302
  web: <(optional) package or maintainer's url>
333
303
  poc: <(optional) maintainer's email>
334
304
  pythonVersion: <(optional) python version for sandboxing if applicable>
@@ -346,7 +316,7 @@ mkdir /tmp/test_show && cd /tmp/test_show
346
316
  # Initialize a package with the default dependency on public PartCAD repository
347
317
  pc init
348
318
 
349
- # Show one of available parts in 'OCP CAD Viewer'
319
+ # Show the part in 'OCP CAD Viewer'
350
320
  pc show fastener/screw-buttonhead standard-metric-cqwarehouse
351
321
  ```
352
322
 
@@ -361,25 +331,35 @@ cd partcad-cqwarehouse
361
331
  pc render
362
332
  ```
363
333
 
364
- ### Publishing
334
+ See [an example](./examples/feature_export/) how to configure package's
335
+ rendering settings.
365
336
 
366
- It is very simple to publish your package to the public PartCAD repository.
337
+ ### Publishing
367
338
 
368
- First, you need to publish your own package which defines the models you want to publish.
339
+ It's very simple to publish your package to the public PartCAD repository.
340
+ First, publish your package (e.g. as a repo on GitHub).
369
341
  Then create a pull request in [the public PartCAD repo](https://github.com/openvmp/partcad) to add a reference to your package.
370
342
 
371
- ## Export
343
+ ## Export PartCAD models
372
344
 
373
345
  ### Images
374
346
 
375
347
  Individual parts, assemblies and scenes can be rendered and exported into the
376
348
  following formats:
377
349
 
350
+ - SVG
378
351
  - PNG
379
352
  - [STEP]
380
353
  - [STL](https://en.wikipedia.org/wiki/STL_(file_format))
381
354
  - [3MF](https://en.wikipedia.org/wiki/3D_Manufacturing_Format)
382
355
  - [ThreeJS](https://en.wikipedia.org/wiki/Three.js)
356
+ - [OBJ](https://en.wikipedia.org/wiki/Wavefront_.obj_file)
357
+
358
+ ```shell
359
+ # Some "export to a file" examples:
360
+ $ pc render -p -t stl <part> [<package>]
361
+ $ pc render -p -t step -a <assembly> [<package>]
362
+ ```
383
363
 
384
364
  Expect more image formats to be added to the list of supported export formats in the future.
385
365
 
@@ -1,4 +1,4 @@
1
- partcad==0.3.66
1
+ partcad==0.3.70
2
2
  pycairo
3
3
  renderlab
4
4
  rlPyCairo
File without changes