Skip to content

Commit

Permalink
Merge branch '3d-model-offsets' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
uPesy committed Jun 25, 2022
2 parents 6e2e3a7 + 30f63d3 commit 885a8ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion easyeda2kicad/easyeda/parameters_easyeda.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ class Ee3dModelBase(BaseModel):
def convert_to_mm(self) -> None:
self.x = convert_to_mm(self.x)
self.y = convert_to_mm(self.y)
# self.z = convert_to_mm(self.z)
self.z = convert_to_mm(self.z)


@dataclass
Expand Down
20 changes: 14 additions & 6 deletions easyeda2kicad/kicad/export_kicad_footprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,26 @@ def generate_kicad_footprint(self) -> None:
if self.input.model_3d is not None:
self.input.model_3d.convert_to_mm()

if self.input.model_3d.translation.z != 0:
self.input.model_3d.translation.z -= 1
print(self.input.bbox)
ki_3d_model_info = Ki3dModel(
name=self.input.model_3d.name,
translation=Ki3dModelBase(
# x=round((self.input.model_3d.translation.x - self.input.bbox.x), 2),
# y=-round(
# (self.input.model_3d.translation.y - self.input.bbox.y), 2
# ),
# z=round(self.input.model_3d.translation.z * 0.0254, 2),
x=round((self.input.model_3d.translation.x - self.input.bbox.x), 2),
y=-round(
(self.input.model_3d.translation.y - self.input.bbox.y), 2
),
z=-round(self.input.model_3d.translation.z, 2),
),
rotation=Ki3dModelBase(
x=(360 - self.input.model_3d.rotation.x) % 360,
y=(360 - self.input.model_3d.rotation.y) % 360,
z=(360 - self.input.model_3d.rotation.z) % 360,
),
rotation=self.input.model_3d.rotation,
raw_wrl=None,
)
print(ki_3d_model_info)
else:
ki_3d_model_info = None

Expand Down

0 comments on commit 885a8ce

Please sign in to comment.