-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbox.py
More file actions
37 lines (26 loc) · 829 Bytes
/
box.py
File metadata and controls
37 lines (26 loc) · 829 Bytes
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
from OCC.Display.SimpleGui import init_display
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox
def create_box(width, height, depth):
"""
Function to create a 3D box.
Args:
width (float): Width of the box.
height (float): Height of the box.
depth (float): Depth of the box.
Returns:
TopoDS_Shape: The TopoDS shape of the box.
"""
# Create a box
box = BRepPrimAPI_MakeBox(width, height, depth).Shape()
return box
def main():
# Initialize the display
display, start_display, add_menu, add_function_to_menu = init_display()
# Create a box with dimensions 10x20x30
my_box = create_box(10.0, 20.0, 30.0)
# Display the box
display.DisplayShape(my_box, update=True)
# Start the GUI loop
start_display()
if __name__ == "__main__":
main()