-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTile.py
More file actions
65 lines (53 loc) · 1.65 KB
/
Copy pathTile.py
File metadata and controls
65 lines (53 loc) · 1.65 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
import maya.mel as mel
import maya.cmds as cmds
from Transform import Transform
from Mesh import Mesh
class Tile(object):
@property
def Transform(self):
return self.transform
@Transform.setter
def Transform(self, value):
self.transform = value
@property
def Name(self):
return self.Transform.Name
@Name.setter
def Name(self, value):
self.Transform.Name = value
def __init__(self):
self.transform = Transform()
self._length = 0
self._height = 0
self._width = 0
def Duplicate(self):
mel.eval("select - r " + self.Transform.Name)
name = mel.eval("duplicate - rr")
newTile = Tile()
newTile.Transform.Name = name[0]
return newTile
def caculate_length_height_width(self):
mesh = Mesh()
mesh.Name = self.Transform.Name + "Shape"
vertexs = mesh.GetVertexsPos()
listX = []
listY = []
listZ = []
for v in vertexs:
listX.append(v.x)
listY.append(v.y)
listZ.append(v.z)
self._length = max(listZ) - min(listZ)
self._height = max(listY) - min(listY)
self._width = max(listX) - min(listX)
def GetLength(self):
self.caculate_length_height_width()
return self._length
def GetHeight(self):
self.caculate_length_height_width()
return self._height
def GetWidth(self):
self.caculate_length_height_width()
return self._width
def PrintInfo(self):
print "Tile Length = {0}, Width = {1}, Height = {2}".format(self._length, self._width, self._height)