-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEquipment.py
More file actions
60 lines (45 loc) · 1.57 KB
/
Copy pathEquipment.py
File metadata and controls
60 lines (45 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""Equipment class definition file."""
from parapy.core import Attribute, Base, Input, Part, derived
from parapy.geom import Box, Orientation, Point, Position, Vector
class Equipment(Base):
"""Represent the Equipment class.
This class is the template for each equipment object and contains the name, position and size.
"""
equipment_dict: dict = Input()
name: str = Input(derived)
coordinate: Point = Input(derived)
node_number: int = Input()
size: float = Input(100)
@name.getter
def name(self) -> str:
"""Return the equipment name from the dict."""
return self.equipment_dict["name"]
@coordinate.getter
def coordinate(self) -> Point:
"""Return the equipment coordinate from the dict."""
return self.equipment_dict["coordinate"]
@Attribute
def position(self) -> Position:
"""Create a position attribute.
Returns:
Position: position attribute.
"""
return Position(
location=self.coordinate,
orientation=Orientation(
x=Vector(1, 0, 0), y=Vector(0, 1, 0), z=Vector(0, 0, 1)
),
)
@Part
def box(self) -> Box:
"""Create a box to display the equipment visually in the gui.
Returns:
Box: box representing equipment.
"""
return Box(
width=self.size,
length=self.size,
height=self.size,
position=self.position,
centered=True
)