-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRV_pattern.py
More file actions
97 lines (70 loc) · 2.8 KB
/
RV_pattern.py
File metadata and controls
97 lines (70 loc) · 2.8 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#! python3
# venv: brg-csd
# r: compas_rv>=0.9.5
import rhinoscriptsyntax as rs # type: ignore
from compas_rv.commands import make_pattern_from_meshgrid
from compas_rv.commands import make_pattern_from_rhinolines
from compas_rv.commands import make_pattern_from_rhinomesh
from compas_rv.commands import make_pattern_from_rhinosurface
from compas_rv.commands import make_pattern_from_skeleton
from compas_rv.commands import make_pattern_from_triangulation
from compas_rv.commands import make_pattern_from_template
from compas_rv.session import RVSession
def RunCommand():
session = RVSession()
form = session.find_formdiagram(warn=False)
force = session.find_forcediagram(warn=False)
if form or force:
return session.warn("Please remove all form and force diagrams before using pattern commands.")
patternobj = session.find_pattern(warn=False)
if patternobj:
if not session.confirm("This will remove all current RhinoVAULT data and objects. Do you wish to proceed?"):
return
session.scene.clear()
# =============================================================================
# Make a Force "Pattern"
# =============================================================================
option = rs.GetString(
message="Pattern From",
strings=[
"RhinoLines",
"RhinoMesh",
"RhinoSurface",
"MeshGrid",
"Triangulation",
"Skeleton",
"Json",
"Template",
],
)
if option == "RhinoLines":
pattern = make_pattern_from_rhinolines()
elif option == "RhinoMesh":
pattern = make_pattern_from_rhinomesh()
elif option == "RhinoSurface":
pattern = make_pattern_from_rhinosurface()
elif option == "MeshGrid":
pattern = make_pattern_from_meshgrid()
elif option == "Triangulation":
pattern = make_pattern_from_triangulation()
elif option == "Skeleton":
pattern = make_pattern_from_skeleton()
elif option == "Json":
raise NotImplementedError
elif option == "Template":
pattern = make_pattern_from_template()
else:
return
# =============================================================================
# Update scene
# =============================================================================
session.scene.add(pattern, name=pattern.name, layer="RhinoVAULT::Pattern") # type: ignore
session.scene.draw()
print("Pattern successfully created.")
if session.settings.autosave:
session.record(name="Make Pattern")
# =============================================================================
# Run as main
# =============================================================================
if __name__ == "__main__":
RunCommand()