Skip to content

Commit

Permalink
Add static method zero() to Position3D and Rotation3D
Browse files Browse the repository at this point in the history
ubruhin committed Sep 15, 2023
1 parent dc0e4bd commit 23175f7
Showing 7 changed files with 20 additions and 12 deletions.
8 changes: 8 additions & 0 deletions entities/common.py
Original file line number Diff line number Diff line change
@@ -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))

4 changes: 2 additions & 2 deletions generate_capacitor_radial_tht.py
Original file line number Diff line number Diff line change
@@ -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')
4 changes: 2 additions & 2 deletions generate_chip.py
Original file line number Diff line number Diff line change
@@ -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)

4 changes: 2 additions & 2 deletions generate_dip.py
Original file line number Diff line number Diff line change
@@ -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)

4 changes: 2 additions & 2 deletions generate_do.py
Original file line number Diff line number Diff line change
@@ -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)

4 changes: 2 additions & 2 deletions generate_idc.py
Original file line number Diff line number Diff line change
@@ -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)

4 changes: 2 additions & 2 deletions generate_led.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 23175f7

Please sign in to comment.