makerrepo-cli 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl

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.
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+
3
+ (function () {
4
+ const MAP_HEX = {
5
+ 0: 0,
6
+ 1: 1,
7
+ 2: 2,
8
+ 3: 3,
9
+ 4: 4,
10
+ 5: 5,
11
+ 6: 6,
12
+ 7: 7,
13
+ 8: 8,
14
+ 9: 9,
15
+ a: 10,
16
+ b: 11,
17
+ c: 12,
18
+ d: 13,
19
+ e: 14,
20
+ f: 15,
21
+ A: 10,
22
+ B: 11,
23
+ C: 12,
24
+ D: 13,
25
+ E: 14,
26
+ F: 15
27
+ };
28
+
29
+ function debugLog(tag, obj) {
30
+ console.log(tag, obj);
31
+ }
32
+
33
+ function fromHex(hexString) {
34
+ const bytes = new Uint8Array(
35
+ Math.floor((hexString || "").length / 2)
36
+ );
37
+ let i;
38
+ for (i = 0; i < bytes.length; i++) {
39
+ const a = MAP_HEX[hexString[i * 2]];
40
+ const b = MAP_HEX[hexString[i * 2 + 1]];
41
+ if (a === undefined || b === undefined) {
42
+ break;
43
+ }
44
+ bytes[i] = (a << 4) | b;
45
+ }
46
+ return i === bytes.length ? bytes : bytes.slice(0, i);
47
+ }
48
+
49
+ function fromB64(s) {
50
+ const bytes = atob(s);
51
+ const uint = new Uint8Array(bytes.length);
52
+ for (let i = 0; i < bytes.length; i++) {
53
+ uint[i] = bytes[i].charCodeAt(0);
54
+ }
55
+ return uint;
56
+ }
57
+
58
+ function convert(obj) {
59
+ let result;
60
+ if (typeof obj.buffer === "string") {
61
+ let buffer;
62
+ if (obj.codec === "b64") {
63
+ buffer = fromB64(obj.buffer);
64
+ } else {
65
+ buffer = fromHex(obj.buffer);
66
+ }
67
+ if (obj.dtype === "float32") {
68
+ result = new Float32Array(buffer.buffer);
69
+ } else if (obj.dtype === "int32") {
70
+ result = new Uint32Array(buffer.buffer);
71
+ } else if (obj.dtype === "uint32") {
72
+ result = new Uint32Array(buffer.buffer);
73
+ } else {
74
+ debugLog("Error: unknown dtype", obj.dtype);
75
+ }
76
+ } else if (Array.isArray(obj)) {
77
+ result = [];
78
+ for (const arr of obj) {
79
+ result.push(convert(arr));
80
+ }
81
+ return result;
82
+ } else {
83
+ debugLog("Error: unknown buffer type", obj.buffer);
84
+ }
85
+ return result;
86
+ }
87
+
88
+ function walk(obj, instances) {
89
+ let type = null;
90
+ for (const attr in obj) {
91
+ if (attr === "parts") {
92
+ for (const i in obj.parts) {
93
+ walk(obj.parts[i], instances);
94
+ }
95
+ } else if (attr === "type") {
96
+ type = obj.type;
97
+ } else if (attr === "shape") {
98
+ if (type === "shapes") {
99
+ if (obj.shape.ref === undefined) {
100
+ obj.shape.vertices = convert(
101
+ obj.shape.vertices
102
+ );
103
+ obj.shape.obj_vertices = convert(
104
+ obj.shape.obj_vertices
105
+ );
106
+ obj.shape.normals = convert(
107
+ obj.shape.normals
108
+ );
109
+ obj.shape.edge_types = convert(
110
+ obj.shape.edge_types
111
+ );
112
+ obj.shape.face_types = convert(
113
+ obj.shape.face_types
114
+ );
115
+ obj.shape.triangles = convert(
116
+ obj.shape.triangles
117
+ );
118
+ obj.shape.triangles_per_face = convert(
119
+ obj.shape.triangles_per_face
120
+ );
121
+ obj.shape.edges = convert(obj.shape.edges);
122
+ obj.shape.segments_per_edge = convert(
123
+ obj.shape.segments_per_edge
124
+ );
125
+ } else {
126
+ const ind = obj.shape.ref;
127
+ if (ind !== undefined && instances !== undefined) {
128
+ obj.shape = instances[ind];
129
+ }
130
+ }
131
+ } else if (type === "edges") {
132
+ obj.shape.edges = convert(obj.shape.edges);
133
+ if (obj.shape.edges === undefined) {
134
+ obj.shape.edges = [];
135
+ }
136
+ obj.shape.segments_per_edge = convert(
137
+ obj.shape.segments_per_edge
138
+ );
139
+ obj.shape.obj_vertices = convert(
140
+ obj.shape.obj_vertices
141
+ );
142
+ } else {
143
+ obj.shape.obj_vertices = convert(
144
+ obj.shape.obj_vertices
145
+ );
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ function decode(model) {
152
+ model.instances.forEach((instance) => {
153
+ instance.vertices = convert(instance.vertices);
154
+ instance.obj_vertices = convert(instance.obj_vertices);
155
+ instance.normals = convert(instance.normals);
156
+ instance.edge_types = convert(instance.edge_types);
157
+ instance.face_types = convert(instance.face_types);
158
+ instance.triangles = convert(instance.triangles);
159
+ instance.triangles_per_face = convert(
160
+ instance.triangles_per_face
161
+ );
162
+ instance.edges = convert(instance.edges);
163
+ instance.segments_per_edge = convert(
164
+ instance.segments_per_edge
165
+ );
166
+ });
167
+
168
+ walk(model.shapes, model.instances);
169
+ model.instances = [];
170
+ }
171
+
172
+ // Expose walk function via namespace
173
+ window.CadUtils = {
174
+ decode
175
+ };
176
+ })();
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: makerrepo-cli
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -10,9 +10,13 @@ makerrepo_cli/cmds/artifacts/cli.py,sha256=zBohKuBgn3j6NkEkVAV8ahwHuqX7HnSEplEn_
10
10
  makerrepo_cli/cmds/artifacts/main.py,sha256=rYO8M3ouhVC7n8RRYaC7CrZHQVsOGDUwMjzQK3AUQMo,5050
11
11
  makerrepo_cli/cmds/artifacts/ocp_data_types.py,sha256=-YeAio5godIYcJPzoDIdu67MbqiJDMBkq8QcJJXQvMA,1175
12
12
  makerrepo_cli/cmds/artifacts/utils.py,sha256=ZSLfm-S2uYk7Y7mq2fhK2Ki4OC2C6O0bNCZ5nDFLLEo,943
13
- makerrepo_cli-0.1.2.dist-info/licenses/LICENSE,sha256=e1FWoucPP7MUG3AOBwb3R6PhN4N3KomjFLvu7CWar5Q,1072
14
- makerrepo_cli-0.1.2.dist-info/METADATA,sha256=aLj0TbrqG5ZckvCKmPT4aqAR2HgWC3kV39zk0pddbw4,405
15
- makerrepo_cli-0.1.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
16
- makerrepo_cli-0.1.2.dist-info/entry_points.txt,sha256=Wcv5tkqI8NIiXZXJAZxTlVwy__9nT0ZfIktwNpPYjWE,95
17
- makerrepo_cli-0.1.2.dist-info/top_level.txt,sha256=0sONY8MHgWTad63qvsjR1KXe7OOCwF66pDWm6iITrNM,14
18
- makerrepo_cli-0.1.2.dist-info/RECORD,,
13
+ makerrepo_cli/data/cad_viewer.html,sha256=f839kBax2gAbPp2oZf_ha7iT0IufcYHtdQXAbbhrqj8,2709
14
+ makerrepo_cli/data/three-cad-viewer-3.6.3.css,sha256=JvrVJ7kb6Ljur3bilst4ZYj0esyxxG4j8K73QnOA4HE,114336
15
+ makerrepo_cli/data/three-cad-viewer-3.6.3.js,sha256=FsCyLftjZx5EDgg92ApCsjD6weU-G3Y5ZLtXI4x_M_E,2458129
16
+ makerrepo_cli/data/utils.js,sha256=3n4qw942CsxPRbsqQCTDecEfYOsgF4JcKISSnlUoCcc,5669
17
+ makerrepo_cli-0.1.3.dist-info/licenses/LICENSE,sha256=e1FWoucPP7MUG3AOBwb3R6PhN4N3KomjFLvu7CWar5Q,1072
18
+ makerrepo_cli-0.1.3.dist-info/METADATA,sha256=108JUSGQoePxSWHZCLtGQskbadR_BopuaIzqf543oaA,405
19
+ makerrepo_cli-0.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
20
+ makerrepo_cli-0.1.3.dist-info/entry_points.txt,sha256=Wcv5tkqI8NIiXZXJAZxTlVwy__9nT0ZfIktwNpPYjWE,95
21
+ makerrepo_cli-0.1.3.dist-info/top_level.txt,sha256=0sONY8MHgWTad63qvsjR1KXe7OOCwF66pDWm6iITrNM,14
22
+ makerrepo_cli-0.1.3.dist-info/RECORD,,