partcad-cli 0.3.75__tar.gz → 0.3.84__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.
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/PKG-INFO +2 -2
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/pyproject.toml +1 -1
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/requirements.txt +1 -1
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli/__init__.py +1 -1
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli/cli.py +5 -0
- partcad-cli-0.3.84/src/partcad_cli/cli_info.py +78 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli/cli_list.py +15 -36
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli/cli_show.py +20 -2
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli.egg-info/PKG-INFO +2 -2
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli.egg-info/SOURCES.txt +1 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli.egg-info/requires.txt +1 -1
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/README.md +0 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/setup.cfg +0 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli/cli_add.py +0 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli/cli_init.py +0 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli/cli_install.py +0 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli/cli_render.py +0 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli.egg-info/dependency_links.txt +0 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/src/partcad_cli.egg-info/entry_points.txt +0 -0
- {partcad-cli-0.3.75 → partcad-cli-0.3.84}/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.
|
|
3
|
+
Version: 0.3.84
|
|
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.
|
|
15
|
+
Requires-Dist: partcad==0.3.84
|
|
16
16
|
Requires-Dist: pycairo
|
|
17
17
|
Requires-Dist: renderlab
|
|
18
18
|
Requires-Dist: rlPyCairo
|
|
@@ -15,6 +15,7 @@ import partcad as pc
|
|
|
15
15
|
|
|
16
16
|
from .cli_add import *
|
|
17
17
|
from .cli_init import *
|
|
18
|
+
from .cli_info import *
|
|
18
19
|
from .cli_install import *
|
|
19
20
|
from .cli_list import *
|
|
20
21
|
from .cli_render import *
|
|
@@ -47,6 +48,7 @@ def main():
|
|
|
47
48
|
subparsers = parser.add_subparsers(dest="command")
|
|
48
49
|
cli_help_add(subparsers)
|
|
49
50
|
cli_help_init(subparsers)
|
|
51
|
+
cli_help_info(subparsers)
|
|
50
52
|
cli_help_install(subparsers)
|
|
51
53
|
cli_help_list(subparsers)
|
|
52
54
|
cli_help_render(subparsers)
|
|
@@ -71,6 +73,9 @@ def main():
|
|
|
71
73
|
elif args.command == "init":
|
|
72
74
|
cli_init(args)
|
|
73
75
|
|
|
76
|
+
elif args.command == "info":
|
|
77
|
+
cli_info(args)
|
|
78
|
+
|
|
74
79
|
elif args.command == "install":
|
|
75
80
|
cli_install(args)
|
|
76
81
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#
|
|
2
|
+
# OpenVMP, 2023
|
|
3
|
+
#
|
|
4
|
+
# Author: Roman Kuzmenko
|
|
5
|
+
# Created: 2024-01-23
|
|
6
|
+
#
|
|
7
|
+
# Licensed under Apache License, Version 2.0.
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
from pprint import pprint
|
|
12
|
+
|
|
13
|
+
import partcad as pc
|
|
14
|
+
from partcad.utils import total_size
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def cli_help_info(subparsers):
|
|
18
|
+
parser_info = subparsers.add_parser(
|
|
19
|
+
"info",
|
|
20
|
+
help="Show detailed info a part, assembly or scene",
|
|
21
|
+
)
|
|
22
|
+
group_type = parser_info.add_mutually_exclusive_group(required=False)
|
|
23
|
+
group_type.add_argument(
|
|
24
|
+
"-a",
|
|
25
|
+
help="The object is an assembly",
|
|
26
|
+
dest="assembly",
|
|
27
|
+
action="store_true",
|
|
28
|
+
)
|
|
29
|
+
group_type.add_argument(
|
|
30
|
+
"-s",
|
|
31
|
+
help="The object is a scene",
|
|
32
|
+
dest="scene",
|
|
33
|
+
action="store_true",
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
parser_info.add_argument(
|
|
37
|
+
"object",
|
|
38
|
+
help="Part (default), assembly or scene to show",
|
|
39
|
+
type=str,
|
|
40
|
+
)
|
|
41
|
+
parser_info.add_argument(
|
|
42
|
+
"package",
|
|
43
|
+
help="Package to retrieve the object from",
|
|
44
|
+
type=str,
|
|
45
|
+
nargs="?",
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def cli_info(args):
|
|
50
|
+
if not args.config_path is None:
|
|
51
|
+
ctx = pc.init(args.config_path)
|
|
52
|
+
else:
|
|
53
|
+
ctx = pc.init()
|
|
54
|
+
|
|
55
|
+
if args.package is None:
|
|
56
|
+
package = "this"
|
|
57
|
+
else:
|
|
58
|
+
package = args.package
|
|
59
|
+
|
|
60
|
+
if args.assembly:
|
|
61
|
+
obj = ctx.get_assembly(args.object, package)
|
|
62
|
+
else:
|
|
63
|
+
obj = ctx.get_part(args.object, package)
|
|
64
|
+
|
|
65
|
+
if obj is None:
|
|
66
|
+
if args.package is None:
|
|
67
|
+
logging.error("Object %s not found" % args.object)
|
|
68
|
+
else:
|
|
69
|
+
logging.error(
|
|
70
|
+
"Object %s not found in package %s" % (args.object, args.package)
|
|
71
|
+
)
|
|
72
|
+
else:
|
|
73
|
+
print("CONFIGURATION:")
|
|
74
|
+
pprint(obj.config)
|
|
75
|
+
print()
|
|
76
|
+
print("RUNTIME PROPERTIES:")
|
|
77
|
+
obj.get_shape()
|
|
78
|
+
print("Memory: %d KB" % ((total_size(obj) + 1023) / 1024))
|
|
@@ -119,32 +119,21 @@ def cli_list_parts(args):
|
|
|
119
119
|
continue
|
|
120
120
|
project = ctx.projects[project_name]
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
if
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
):
|
|
127
|
-
part_names = project.config_obj["parts"].keys()
|
|
128
|
-
else:
|
|
129
|
-
part_names = []
|
|
130
|
-
else:
|
|
131
|
-
part_names = project.parts.keys()
|
|
132
|
-
for part_name in part_names:
|
|
122
|
+
for part_name, part in project.parts.items():
|
|
123
|
+
if args.used_by is not None and part.count == 0:
|
|
124
|
+
continue
|
|
125
|
+
|
|
133
126
|
line = "\t"
|
|
134
127
|
if args.recursive:
|
|
135
128
|
line += "%s" % project_name
|
|
136
|
-
line += " " * (
|
|
129
|
+
line += " " + " " * (35 - len(project_name))
|
|
137
130
|
line += "%s" % part_name
|
|
138
131
|
if args.used_by is not None:
|
|
139
132
|
part = project.parts[part_name]
|
|
140
133
|
line += "(%d)" % part.count
|
|
141
134
|
part_count = part_count + part.count
|
|
142
|
-
line += " " * (
|
|
143
|
-
|
|
144
|
-
project.config_obj["parts"][part_name] is not None
|
|
145
|
-
and "desc" in project.config_obj["parts"][part_name]
|
|
146
|
-
):
|
|
147
|
-
line += "%s" % project.config_obj["parts"][part_name]["desc"]
|
|
135
|
+
line += " " + " " * (35 - len(part_name))
|
|
136
|
+
line += "%s" % part.desc
|
|
148
137
|
print(line)
|
|
149
138
|
part_kinds = part_kinds + 1
|
|
150
139
|
|
|
@@ -167,6 +156,7 @@ def cli_list_assemblies(args):
|
|
|
167
156
|
|
|
168
157
|
if args.used_by is not None:
|
|
169
158
|
print("Instantiating %s..." % args.used_by)
|
|
159
|
+
# TODO(clairbee): do not call it twice in 'list-all'
|
|
170
160
|
pc.get_assembly(args.used_by)
|
|
171
161
|
|
|
172
162
|
print()
|
|
@@ -178,32 +168,21 @@ def cli_list_assemblies(args):
|
|
|
178
168
|
continue
|
|
179
169
|
project = ctx.projects[project_name]
|
|
180
170
|
|
|
181
|
-
|
|
182
|
-
if
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
):
|
|
186
|
-
assy_names = project.config_obj["assemblies"].keys()
|
|
187
|
-
else:
|
|
188
|
-
assy_names = []
|
|
189
|
-
else:
|
|
190
|
-
assy_names = project.assemblies.keys()
|
|
191
|
-
for assy_name in assy_names:
|
|
171
|
+
for assy_name, assy in project.assemblies.items():
|
|
172
|
+
if args.used_by is not None and assy.count == 0:
|
|
173
|
+
continue
|
|
174
|
+
|
|
192
175
|
line = "\t"
|
|
193
176
|
if args.recursive:
|
|
194
177
|
line += "%s" % project_name
|
|
195
|
-
line += " " * (
|
|
178
|
+
line += " " + " " * (35 - len(project_name))
|
|
196
179
|
line += "%s" % assy_name
|
|
197
180
|
if args.used_by is not None:
|
|
198
181
|
assy = project.assemblies[assy_name]
|
|
199
182
|
line += "(%d)" % assy.count
|
|
200
183
|
assy_count = assy_count + assy.count
|
|
201
|
-
line += " " * (
|
|
202
|
-
|
|
203
|
-
project.config_obj["assemblies"][assy_name] is not None
|
|
204
|
-
and "desc" in project.config_obj["assemblies"][assy_name]
|
|
205
|
-
):
|
|
206
|
-
line += "%s" % project.config_obj["assemblies"][assy_name]["desc"]
|
|
184
|
+
line += " " + " " * (35 - len(assy_name))
|
|
185
|
+
line += "%s" % assy.desc
|
|
207
186
|
print(line)
|
|
208
187
|
assy_kinds = assy_kinds + 1
|
|
209
188
|
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
# Licensed under Apache License, Version 2.0.
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
+
# import argparse
|
|
10
11
|
import logging
|
|
11
12
|
|
|
12
13
|
import partcad as pc
|
|
13
14
|
|
|
14
15
|
|
|
16
|
+
# TODO(clairbee): fix type checking here
|
|
17
|
+
# def cli_help_show(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]):
|
|
15
18
|
def cli_help_show(subparsers):
|
|
16
19
|
parser_show = subparsers.add_parser(
|
|
17
20
|
"show",
|
|
@@ -31,6 +34,15 @@ def cli_help_show(subparsers):
|
|
|
31
34
|
action="store_true",
|
|
32
35
|
)
|
|
33
36
|
|
|
37
|
+
parser_show.add_argument(
|
|
38
|
+
"-p",
|
|
39
|
+
"--param",
|
|
40
|
+
metavar="<param_name>=<param_value>",
|
|
41
|
+
help="Assign a value to the parameter",
|
|
42
|
+
dest="params",
|
|
43
|
+
action="append",
|
|
44
|
+
)
|
|
45
|
+
|
|
34
46
|
parser_show.add_argument(
|
|
35
47
|
"object",
|
|
36
48
|
help="Part (default), assembly or scene to show",
|
|
@@ -55,10 +67,16 @@ def cli_show(args):
|
|
|
55
67
|
else:
|
|
56
68
|
package = args.package
|
|
57
69
|
|
|
70
|
+
params = {}
|
|
71
|
+
if not args.params is None:
|
|
72
|
+
for kv in args.params:
|
|
73
|
+
k, v = kv.split("=")
|
|
74
|
+
params[k] = v
|
|
75
|
+
|
|
58
76
|
if args.assembly:
|
|
59
|
-
obj = ctx.get_assembly(args.object, package)
|
|
77
|
+
obj = ctx.get_assembly(args.object, package, params=params)
|
|
60
78
|
else:
|
|
61
|
-
obj = ctx.get_part(args.object, package)
|
|
79
|
+
obj = ctx.get_part(args.object, package, params=params)
|
|
62
80
|
|
|
63
81
|
if obj is None:
|
|
64
82
|
if args.package is None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: partcad-cli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.84
|
|
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.
|
|
15
|
+
Requires-Dist: partcad==0.3.84
|
|
16
16
|
Requires-Dist: pycairo
|
|
17
17
|
Requires-Dist: renderlab
|
|
18
18
|
Requires-Dist: rlPyCairo
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|