127 """ getParametersOfFace(structure, facename, sketch = True): This function will return 128 length, width and points of center of mass of a given face according to the sketch 129 value in the form of list. 132 Case 1: When sketch is True: We use True when we want to create rebars from sketch 133 (planar rebars) and the sketch is strictly based on 2D so we neglected the normal 135 Output: [(FaceLength, FaceWidth), (CenterOfMassX, CenterOfMassY)] 137 Case 2: When sketch is False: When we want to create non-planar rebars(like stirrup) 138 or we want to create rebar from a wire. Also for creating rebar from wire 139 we will require three coordinates (x, y, z). 140 Output: [(FaceLength, FaceWidth), (CenterOfMassX, CenterOfMassY, CenterOfMassZ)]""" 142 center_of_mass = face.CenterOfMass
144 center_of_mass = center_of_mass.sub(structure.Placement.Base)
149 if isCubic(structure.Shape):
151 for edge
in face.Edges:
157 if round((vec(edge)).Length)
not in [round((vec(x)).Length)
for x
in Edges]:
162 facePRM = [(vec(edge)).Length
for edge
in Edges]
166 if round(Edges[0].tangentAt(0)[0])
in {1,-1}:
167 x = center_of_mass[0]
168 if round(Edges[1].tangentAt(0)[1])
in {1, -1}:
169 y = center_of_mass[1]
171 y = center_of_mass[2]
173 elif round(Edges[0].tangentAt(0)[1])
in {1,-1}:
174 x = center_of_mass[1]
175 if round(Edges[1].tangentAt(0)[0])
in {1, -1}:
178 y = center_of_mass[1]
180 y = center_of_mass[2]
181 elif round(Edges[0].tangentAt(0)[2])
in {1,-1}:
182 y = center_of_mass[2]
183 if round(Edges[1].tangentAt(0)[0])
in {1, -1}:
184 x = center_of_mass[0]
186 x = center_of_mass[1]
188 facelength = facePRM[0]
189 facewidth = facePRM[1]
193 boundbox = face.BoundBox
196 if 0
in {round(boundbox.XLength), round(boundbox.YLength), round(boundbox.ZLength)}:
197 normal = face.normalAt(0,0)
198 normal = face.Placement.Rotation.inverted().multVec(normal)
205 for i
in range(len(normal)):
206 if round(normal[i]) == 0:
208 x = center_of_mass[i]
209 facelength = boundbox.XLength
211 elif flag
and i == 1:
212 x = center_of_mass[i]
213 facelength = boundbox.YLength
216 y = center_of_mass[i]
217 facewidth = boundbox.YLength
219 y = center_of_mass[i]
220 facewidth = boundbox.ZLength
225 center_of_mass = face.CenterOfMass
226 return [(facelength, facewidth), center_of_mass]
229 return [(facelength, facewidth), (x, y)]
def getParametersOfFace(structure, facename, sketch=True)