diff --git a/entities/common.py b/entities/common.py index a9f75ad..b2c9911 100644 --- a/entities/common.py +++ b/entities/common.py @@ -130,6 +130,10 @@ def __init__(self, x: float, y: float, z: float): self.y = y self.z = z + @staticmethod + def zero() -> 'Position3D': + return Position3D(0.0, 0.0, 0.0) + def __str__(self) -> str: return '(3d_position {} {} {})'.format(format_float(self.x), format_float(self.y), format_float(self.z)) @@ -145,6 +149,10 @@ def __init__(self, x: float, y: float, z: float): self.y = y self.z = z + @staticmethod + def zero() -> 'Rotation3D': + return Rotation3D(0.0, 0.0, 0.0) + def __str__(self) -> str: return '(3d_rotation {} {} {})'.format(format_float(self.x), format_float(self.y), format_float(self.z)) diff --git a/generate_capacitor_radial_tht.py b/generate_capacitor_radial_tht.py index 9dea7f7..d5f64f3 100644 --- a/generate_capacitor_radial_tht.py +++ b/generate_capacitor_radial_tht.py @@ -131,8 +131,8 @@ def _generate_fill_polygon(identifier: str, layer: str) -> Polygon: uuid=_fpt_uuid('footprint'), name=Name(name), description=Description(''), - position_3d=Position3D(0.0, 0.0, 0.0), - rotation_3d=Rotation3D(0.0, 0.0, 0.0), + position_3d=Position3D.zero(), + rotation_3d=Rotation3D.zero(), ) pad_hole_path = [Vertex(Position(0.0, 0.0), Angle(0.0))] uuid_plus = _pkg_uuid('pad-plus') diff --git a/generate_chip.py b/generate_chip.py index d01f184..d2aef43 100644 --- a/generate_chip.py +++ b/generate_chip.py @@ -308,8 +308,8 @@ def add_footprint_variant( uuid=uuid_footprint, name=Name(name), description=Description(''), - position_3d=Position3D(0.0, 0.0, 0.0), - rotation_3d=Rotation3D(0.0, 0.0, 0.0), + position_3d=Position3D.zero(), + rotation_3d=Rotation3D.zero(), ) package.add_footprint(footprint) diff --git a/generate_dip.py b/generate_dip.py index 007efd0..e510cae 100644 --- a/generate_dip.py +++ b/generate_dip.py @@ -323,8 +323,8 @@ def add_footprint_variant(key: str, name: str, pad_size: Tuple[float, float]) -> uuid_footprint, Name(name), Description(''), - Position3D(0, 0, 0), - Rotation3D(0, 0, 0), + Position3D.zero(), + Rotation3D.zero(), ) package.add_footprint(footprint) diff --git a/generate_do.py b/generate_do.py index 761ac6e..d80f7c7 100644 --- a/generate_do.py +++ b/generate_do.py @@ -186,8 +186,8 @@ def _add_footprint( uuid=_uuid(uuid_ns + 'footprint'), name=name, description=Description(''), - position_3d=Position3D(0.0, 0.0, 0.0), - rotation_3d=Rotation3D(0.0, 0.0, 0.0), + position_3d=Position3D.zero(), + rotation_3d=Rotation3D.zero(), ) package.add_footprint(footprint) diff --git a/generate_idc.py b/generate_idc.py index e6b10e2..3e7be05 100644 --- a/generate_idc.py +++ b/generate_idc.py @@ -208,8 +208,8 @@ def _uuid(identifier: str) -> str: uuid=uuid_footprint, name=Name('default'), description=Description(''), - position_3d=Position3D(0.0, 0.0, 0.0), - rotation_3d=Rotation3D(0.0, 0.0, 0.0), + position_3d=Position3D.zero(), + rotation_3d=Rotation3D.zero(), ) package.add_footprint(footprint) diff --git a/generate_led.py b/generate_led.py index b2f3886..699d9ae 100644 --- a/generate_led.py +++ b/generate_led.py @@ -154,8 +154,8 @@ def _add_footprint( uuid=_uuid('footprint' + identifier_suffix), name=name, description=Description(''), - position_3d=Position3D(0.0, 0.0, 0.0), - rotation_3d=Rotation3D(0.0, 0.0, 0.0), + position_3d=Position3D.zero(), + rotation_3d=Rotation3D.zero(), ) package.add_footprint(footprint)