-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_models_basescript.py
149 lines (114 loc) · 4.74 KB
/
generate_models_basescript.py
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#makes walls with roman bonding courses
import sys
#import rhinoscriptsyntax as rs
import shutil
#file_path = location of usemasonrycommands.py
file_path = 'C:\\Users\\Rebecca Napolitano\\Documents\\GitHub\\generate3DModels\\'
sys.path.append(file_path)
import useMasonryCmds as umc #this is where the commands for geometry generation, meshing, exporting, saving, etc are
import find_small_rigid_blocks as zeroVol
############################################################################
# SET UP PARAMETERS
directory = "C:\\Users\\Rebecca Napolitano\\Documents\\datafiles\\Romanbondingcourses\\2017_10_26_experiments\\problem_block\\" #Where do you want the files to generate?
wallWidth = 7
wallHeight = 3.3
wallDepth = 2
stoneHeight = 0.3
stoneWidth = 0.5
brickHeight = 0.1
brickWidth = 0.3
firstCourse = 0.9
brickRow = 3
sideBaseWidth = 0.4
#TOL = 1e-5 #what does this do???
meshValue = '0.5 ' #parameter for gsurf meshing
#############################################################################
# do you have anything that needs meshing? anything deformable? commend out anything that does not apply
deformableKeys = []
deformableKeys.append('deformable')
deformableKeys.append('mortar')
deformableKeys.append('infill')
##############################################################################
#generating models
i = 0 #number of bonding courses
j = 0 #width
k = 0 #settlement depth
#make a list of the parameters you want the geometry generation to loop over
#iList = [1, 2]
#jList = [0.5, 2, 3, 4]
#kList = [0, 0.05, 0.1, 0.2]
iList = [2]
jList = [2]
kList = [0.2]
umc.new()
while i <= len(iList) - 1 :
while j <= len(jList) - 1 :
while k <= len(kList) - 1 :
iEntry = iList[i]
jEntry = jList[j]
kEntry = kList[k]
#buildBondingCourseWall(wallWidth, wallHeight, wallDepth, stoneHeight, stoneWidth, brickHeight="Enter", brickWidth="", firstCourse="", brickRow="", bondingCourses="", settleWidth="Enter", settleDepth=""):
umc.buildBondingCourseWallv2(wallWidth, wallHeight, wallDepth, stoneHeight, stoneWidth, brickHeight, brickWidth, firstCourse, brickRow, iEntry, jEntry, kEntry, sideBaseWidth)
#check for zero volume blocks
zeroVol.zero_vol_rigid_blocks()
#create filename
filename = "bc_r" + str(iEntry) + "-w" + str(jEntry) + "-s" + str(kEntry)
#this meshes all blocks ahead of time so that they are exported as simple planes
success = umc.exportLayers(directory, filename, ".wrl")
if not (success):
break
#mesh for deformable
umc.meshing(meshValue, directory)
#save rhino file
success = umc.saveAs(directory, filename, ".3dm")
if not (success):
break
#wrl.wrl23ddat(directory) #crashes it
#changes name of gvol to deformable
shutil.move('Gvol.3ddat', filename + '_deformable.3ddat')
#open a new file
if i < len(iList) + 1:
success = umc.new()
#rs.Command('_Enter')
if not (success):
break
k = k + 1
j = j + 1
k = 0
i = i + 1
j = 0
#generating a second type of model so reset i, j, and k
i = 0 #number of bonding courses
j = 0 #width
k = 0 #settlement depth
umc.new()
while j <= len(jList) - 1 :
while k <= len(kList) - 1 :
#iEntry = iList[i]
jEntry = jList[j]
kEntry = kList[k]
umc.buildNOBC(wallWidth, wallHeight, wallDepth, stoneHeight, stoneWidth, jEntry, kEntry, sideBaseWidth)
#check for zero volume blocks
zeroVol.zero_vol_rigid_blocks()
#create filename
filename = "nobc-w" + str(jEntry) + "-s" + str(kEntry)
#this meshes all blocks ahead of time so that they are exported as simple planes
success = umc.exportLayers(directory, filename, ".wrl")
if not (success):
break
#mesh
umc.meshing(meshValue, directory)
success = umc.saveAs(directory, filename, ".3dm")
if not (success):
break
#wrl.wrl23ddat(directory) #crashes it
#changes name of gvol to deformable
shutil.move('Gvol.3ddat', filename + '_deformable.3ddat')
#open a new file
if k < len(kList) + 1:
success = umc.new()
if not (success):
break
k = k + 1
j = j + 1
k = 0