JLC2KiCadLib 1.0.27__tar.gz → 1.0.29__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.
Potentially problematic release.
This version of JLC2KiCadLib might be problematic. Click here for more details.
- JLC2KiCadLib-1.0.29/JLC2KiCadLib/__version__.py +1 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/footprint/footprint_handlers.py +5 -1
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/footprint/model3d.py +46 -65
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/symbol/symbol_handlers.py +3 -3
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib.egg-info/PKG-INFO +1 -1
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/PKG-INFO +1 -1
- JLC2KiCadLib-1.0.27/JLC2KiCadLib/__version__.py +0 -1
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/JLC2KiCadLib.py +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/__init__.py +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/footprint/__init__.py +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/footprint/footprint.py +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/helper.py +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/symbol/__init__.py +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib/symbol/symbol.py +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib.egg-info/SOURCES.txt +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib.egg-info/dependency_links.txt +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib.egg-info/entry_points.txt +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib.egg-info/requires.txt +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/JLC2KiCadLib.egg-info/top_level.txt +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/LICENSE +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/README.md +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/setup.cfg +0 -0
- {JLC2KiCadLib-1.0.27 → JLC2KiCadLib-1.0.29}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.29"
|
|
@@ -351,15 +351,19 @@ def h_SVGNODE(data, kicad_mod, footprint_info):
|
|
|
351
351
|
logging.exception("footprint handler, h_SVGNODE : failed to parse json data")
|
|
352
352
|
return ()
|
|
353
353
|
|
|
354
|
+
c_origin = data["attrs"]["c_origin"].split(",")
|
|
354
355
|
if "STEP" in footprint_info.models:
|
|
355
356
|
get_StepModel(
|
|
356
357
|
component_uuid=data["attrs"]["uuid"],
|
|
357
358
|
footprint_info=footprint_info,
|
|
358
359
|
kicad_mod=kicad_mod,
|
|
360
|
+
translationX=float(c_origin[0]),
|
|
361
|
+
translationY=float(c_origin[1]),
|
|
362
|
+
translationZ=data["attrs"]["z"],
|
|
363
|
+
rotation=data["attrs"]["c_rotation"],
|
|
359
364
|
)
|
|
360
365
|
|
|
361
366
|
if "WRL" in footprint_info.models:
|
|
362
|
-
c_origin = data["attrs"]["c_origin"].split(",")
|
|
363
367
|
get_WrlModel(
|
|
364
368
|
component_uuid=data["attrs"]["uuid"],
|
|
365
369
|
footprint_info=footprint_info,
|
|
@@ -10,7 +10,19 @@ wrl_header = """#VRML V2.0 utf8
|
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def
|
|
13
|
+
def mil2mm(data):
|
|
14
|
+
return float(data) / 3.937
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def get_StepModel(
|
|
18
|
+
component_uuid,
|
|
19
|
+
footprint_info,
|
|
20
|
+
kicad_mod,
|
|
21
|
+
translationX,
|
|
22
|
+
translationY,
|
|
23
|
+
translationZ,
|
|
24
|
+
rotation,
|
|
25
|
+
):
|
|
14
26
|
logging.info(f"Downloading STEP Model ...")
|
|
15
27
|
|
|
16
28
|
# `qAxj6KHrDKw4blvCG8QJPs7Y` is a constant in
|
|
@@ -20,33 +32,39 @@ def get_StepModel(component_uuid, footprint_info, kicad_mod):
|
|
|
20
32
|
response = requests.get(
|
|
21
33
|
f"https://modules.easyeda.com/qAxj6KHrDKw4blvCG8QJPs7Y/{component_uuid}"
|
|
22
34
|
)
|
|
23
|
-
if response.status_code == requests.codes.ok:
|
|
24
|
-
ensure_footprint_lib_directories_exist(footprint_info)
|
|
25
|
-
filename = f"{footprint_info.output_dir}/{footprint_info.footprint_lib}/{footprint_info.model_dir}/{footprint_info.footprint_name}.step"
|
|
26
|
-
with open(filename, "wb") as f:
|
|
27
|
-
f.write(response.content)
|
|
28
|
-
|
|
29
|
-
logging.info(f"STEP model created at {filename}")
|
|
30
|
-
|
|
31
|
-
if footprint_info.model_base_variable:
|
|
32
|
-
if footprint_info.model_base_variable.startswith("$"):
|
|
33
|
-
path_name = f'"{footprint_info.model_base_variable}/{footprint_info.footprint_name}.step"'
|
|
34
|
-
else:
|
|
35
|
-
path_name = f'"$({footprint_info.model_base_variable})/{footprint_info.footprint_name}.step"'
|
|
36
|
-
else:
|
|
37
|
-
path_name = filename
|
|
38
|
-
|
|
39
|
-
kicad_mod.append(
|
|
40
|
-
Model(
|
|
41
|
-
filename=path_name,
|
|
42
|
-
)
|
|
43
|
-
)
|
|
44
|
-
logging.info(f"added {path_name} to footprint")
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
if not response.status_code == requests.codes.ok:
|
|
47
37
|
logging.error("request error, no Step model found")
|
|
48
38
|
return
|
|
49
39
|
|
|
40
|
+
ensure_footprint_lib_directories_exist(footprint_info)
|
|
41
|
+
filename = f"{footprint_info.output_dir}/{footprint_info.footprint_lib}/{footprint_info.model_dir}/{footprint_info.footprint_name}.step"
|
|
42
|
+
with open(filename, "wb") as f:
|
|
43
|
+
f.write(response.content)
|
|
44
|
+
|
|
45
|
+
logging.info(f"STEP model created at {filename}")
|
|
46
|
+
|
|
47
|
+
if footprint_info.model_base_variable:
|
|
48
|
+
if footprint_info.model_base_variable.startswith("$"):
|
|
49
|
+
path_name = f'"{footprint_info.model_base_variable}/{footprint_info.footprint_name}.step"'
|
|
50
|
+
else:
|
|
51
|
+
path_name = f'"$({footprint_info.model_base_variable})/{footprint_info.footprint_name}.step"'
|
|
52
|
+
else:
|
|
53
|
+
path_name = filename
|
|
54
|
+
|
|
55
|
+
translationX = (translationX - footprint_info.origin[0]) / 100
|
|
56
|
+
translationY = -(translationY - footprint_info.origin[1]) / 100
|
|
57
|
+
translationZ = float(translationZ) / 100
|
|
58
|
+
|
|
59
|
+
kicad_mod.append(
|
|
60
|
+
Model(
|
|
61
|
+
filename=path_name,
|
|
62
|
+
at=[translationX, translationY, translationZ],
|
|
63
|
+
rotate=[-float(axis_rotation) for axis_rotation in rotation.split(",")],
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
logging.info(f"added {path_name} to footprint")
|
|
67
|
+
|
|
50
68
|
|
|
51
69
|
def get_WrlModel(
|
|
52
70
|
component_uuid,
|
|
@@ -68,14 +86,6 @@ def get_WrlModel(
|
|
|
68
86
|
logging.error("request error, no 3D model found")
|
|
69
87
|
return ()
|
|
70
88
|
|
|
71
|
-
"""
|
|
72
|
-
translationX, translationY, translationZ = (
|
|
73
|
-
0,
|
|
74
|
-
0,
|
|
75
|
-
float(translationZ) / 3.048,
|
|
76
|
-
) # foot to mm
|
|
77
|
-
"""
|
|
78
|
-
|
|
79
89
|
wrl_content = wrl_header
|
|
80
90
|
|
|
81
91
|
# get material list
|
|
@@ -164,30 +174,6 @@ Shape{{
|
|
|
164
174
|
|
|
165
175
|
wrl_content += shape_str
|
|
166
176
|
|
|
167
|
-
# find the lowest point of the model
|
|
168
|
-
lowest_point = 0
|
|
169
|
-
for point in vertices:
|
|
170
|
-
if float(point.split(" ")[2]) < lowest_point:
|
|
171
|
-
lowest_point = float(point.split(" ")[2])
|
|
172
|
-
|
|
173
|
-
# convert lowest point to mm
|
|
174
|
-
min_z = lowest_point * 2.54
|
|
175
|
-
|
|
176
|
-
# calculate the translation Z value
|
|
177
|
-
from .footprint_handlers import mil2mm
|
|
178
|
-
|
|
179
|
-
Zmm = mil2mm(translationZ)
|
|
180
|
-
translation_z = Zmm - min_z
|
|
181
|
-
|
|
182
|
-
# find the x and y middle of the model
|
|
183
|
-
x_list = []
|
|
184
|
-
y_list = []
|
|
185
|
-
for point in vertices:
|
|
186
|
-
x_list.append(float(point.split(" ")[0]))
|
|
187
|
-
y_list.append(float(point.split(" ")[1]))
|
|
188
|
-
x_middle = (max(x_list) + min(x_list)) / 2
|
|
189
|
-
y_middle = (max(y_list) + min(y_list)) / 2
|
|
190
|
-
|
|
191
177
|
ensure_footprint_lib_directories_exist(footprint_info)
|
|
192
178
|
|
|
193
179
|
filename = f"{footprint_info.output_dir}/{footprint_info.footprint_lib}/{footprint_info.model_dir}/{footprint_info.footprint_name}.wrl"
|
|
@@ -206,14 +192,9 @@ Shape{{
|
|
|
206
192
|
else:
|
|
207
193
|
path_name = f"{dirname}/{filename}"
|
|
208
194
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
# Convert to inches
|
|
214
|
-
translation_x_inches = translation_x / 100 + x_middle / 10
|
|
215
|
-
translation_y_inches = -translation_y / 100 - y_middle / 10
|
|
216
|
-
translation_z_inches = translation_z / 25.4
|
|
195
|
+
translationX = (translationX - footprint_info.origin[0]) / 100
|
|
196
|
+
translationY = -(translationY - footprint_info.origin[1]) / 100
|
|
197
|
+
translationZ = float(translationZ) / 100
|
|
217
198
|
|
|
218
199
|
# Check if a model has already been added to the footprint to prevent duplicates
|
|
219
200
|
if any(isinstance(child, Model) for child in kicad_mod.getAllChilds()):
|
|
@@ -225,7 +206,7 @@ Shape{{
|
|
|
225
206
|
kicad_mod.append(
|
|
226
207
|
Model(
|
|
227
208
|
filename=path_name,
|
|
228
|
-
at=[
|
|
209
|
+
at=[translationX, translationY, translationZ],
|
|
229
210
|
rotate=[-float(axis_rotation) for axis_rotation in rotation.split(",")],
|
|
230
211
|
)
|
|
231
212
|
)
|
|
@@ -94,8 +94,8 @@ def h_P(data, translation, kicad_symbol):
|
|
|
94
94
|
pinNumber = data[2]
|
|
95
95
|
pinName = data[13]
|
|
96
96
|
|
|
97
|
-
X = mil2mm(float(data[3]) - translation[0])
|
|
98
|
-
Y = -mil2mm(float(data[4]) - translation[1])
|
|
97
|
+
X = round(mil2mm(float(data[3]) - translation[0]), 3)
|
|
98
|
+
Y = round(-mil2mm(float(data[4]) - translation[1]), 3)
|
|
99
99
|
|
|
100
100
|
if data[5] in ["0", "90", "180", "270"]:
|
|
101
101
|
rotation = (int(data[5]) + 180) % 360
|
|
@@ -106,7 +106,7 @@ def h_P(data, translation, kicad_symbol):
|
|
|
106
106
|
)
|
|
107
107
|
|
|
108
108
|
if rotation == 0 or rotation == 180:
|
|
109
|
-
length = mil2mm(abs(float(data[8].split("h")[-1])))
|
|
109
|
+
length = round(mil2mm(abs(float(data[8].split("h")[-1]))), 3)
|
|
110
110
|
elif rotation == 90 or rotation == 270:
|
|
111
111
|
length = mil2mm(abs(float(data[8].split("v")[-1])))
|
|
112
112
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: JLC2KiCadLib
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.29
|
|
4
4
|
Summary: JLC2KiCad_lib is a python script that generate a component library (symbol, footprint and 3D model) for KiCad from the JLCPCB/easyEDA library.
|
|
5
5
|
Home-page: https://github.com/TousstNicolas/JLC2KiCad_lib
|
|
6
6
|
Author: TousstNicolas
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: JLC2KiCadLib
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.29
|
|
4
4
|
Summary: JLC2KiCad_lib is a python script that generate a component library (symbol, footprint and 3D model) for KiCad from the JLCPCB/easyEDA library.
|
|
5
5
|
Home-page: https://github.com/TousstNicolas/JLC2KiCad_lib
|
|
6
6
|
Author: TousstNicolas
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.27"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|