Skip to content

Commit

Permalink
Merge pull request #135 from uPesy/dev
Browse files Browse the repository at this point in the history
Fix some bugs
  • Loading branch information
uPesy authored Jun 17, 2024
2 parents 8eeaab0 + 9d0998b commit b477d9d
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# easyeda2kicad v0.7.0
# easyeda2kicad v0.8.0

_________________
[![PyPI version](https://badge.fury.io/py/easyeda2kicad.svg)](https://badge.fury.io/py/easyeda2kicad)
Expand Down
2 changes: 1 addition & 1 deletion easyeda2kicad/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "0.7.0"
__version__ = "0.8.0"
__author__ = "uPesy"
__email__ = "[email protected]"
2 changes: 1 addition & 1 deletion easyeda2kicad/easyeda/easyeda_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from easyeda2kicad import __version__

API_ENDPOINT = "https://easyeda.com/api/products/{lcsc_id}/components?version=6.4.19.5"
ENDPOINT_3D_MODEL = "https://easyeda.com/analyzer/api/3dmodel/{uuid}"
ENDPOINT_3D_MODEL = "https://modules.easyeda.com/3dmodel/{uuid}"
ENDPOINT_3D_MODEL_STEP = "https://modules.easyeda.com/qAxj6KHrDKw4blvCG8QJPs7Y/{uuid}"
# ENDPOINT_3D_MODEL_STEP found in https://modules.lceda.cn/smt-gl-engine/0.8.22.6032922c/smt-gl-engine.js : points to the bucket containing the step files.

Expand Down
19 changes: 13 additions & 6 deletions easyeda2kicad/kicad/export_kicad_footprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,22 @@ def generate_kicad_footprint(self) -> None:
f"PAD ${ee_pad.id} is a polygon, but has no points defined"
)
else:
# Replace pad width & height since kicad doesn't care
ki_pad.width = 1.0
ki_pad.height = 1.0
# Set the pad width and height to the smallest value allowed by KiCad.
# KiCad tries to draw a pad that forms the base of the polygon,
# but this is often unnecessary and should be disabled.
ki_pad.width = 0.005
ki_pad.height = 0.005

# Generate polygon
# The points of the polygon always seem to correspond to coordinates when orientation=0.
ki_pad.orientation = 0

# Generate polygon with coordinates relative to the base pad's position.
path = "".join(
"(xy {} {})".format(
round(point_list[i] - self.input.bbox.x, 2),
round(point_list[i + 1] - self.input.bbox.y, 2),
round(point_list[i] - self.input.bbox.x - ki_pad.pos_x, 2),
round(
point_list[i + 1] - self.input.bbox.y - ki_pad.pos_y, 2
),
)
for i in range(0, len(point_list), 2)
)
Expand Down
44 changes: 24 additions & 20 deletions easyeda2kicad/kicad/export_kicad_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,19 @@ def convert_ee_polylines(
if isinstance(ee_polyline, EeSymbolPolygon) or ee_polyline.fill_color:
x_points.append(x_points[0])
y_points.append(y_points[0])
if len(x_points) > 0 and len(y_points) > 0:
kicad_polygon = KiSymbolPolygon(
points=[
[x_points[i], y_points[i]]
for i in range(min(len(x_points), len(y_points)))
],
points_number=min(len(x_points), len(y_points)),
is_closed=x_points[0] == x_points[-1] and y_points[0] == y_points[-1],
)

kicad_polygon = KiSymbolPolygon(
points=[
[x_points[i], y_points[i]]
for i in range(min(len(x_points), len(y_points)))
],
points_number=min(len(x_points), len(y_points)),
is_closed=x_points[0] == x_points[-1] and y_points[0] == y_points[-1],
)

kicad_polygons.append(kicad_polygon)
kicad_polygons.append(kicad_polygon)
else:
logging.warning("Skipping polygon with no parseable points")

return kicad_polygons

Expand Down Expand Up @@ -281,17 +283,19 @@ def convert_ee_paths(
# if ee_path.fill_color:
# x_points.append(x_points[0])
# y_points.append(y_points[0])
if len(x_points) > 0 and len(y_points) > 0:
ki_polygon = KiSymbolPolygon(
points=[
[x_points[i], y_points[i]]
for i in range(min(len(x_points), len(y_points)))
],
points_number=min(len(x_points), len(y_points)),
is_closed=x_points[0] == x_points[-1] and y_points[0] == y_points[-1],
)

ki_polygon = KiSymbolPolygon(
points=[
[x_points[i], y_points[i]]
for i in range(min(len(x_points), len(y_points)))
],
points_number=min(len(x_points), len(y_points)),
is_closed=x_points[0] == x_points[-1] and y_points[0] == y_points[-1],
)

kicad_polygons.append(ki_polygon)
kicad_polygons.append(ki_polygon)
else:
logging.warning("Skipping path with no parseable points")

return kicad_polygons, kicad_beziers

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.0
current_version = 0.8.0
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
),
long_description=long_description,
long_description_content_type="text/markdown",
version="0.7.0",
version="0.8.0",
author="uPesy",
author_email="[email protected]",
url="https://github.com/uPesy/easyeda2kicad.py",
Expand Down

0 comments on commit b477d9d

Please sign in to comment.