Cube中同样不需要填充任何参数,它本身是创建一个棱长为1的单位立方体。
示例:
from pyp3d import *
class 立方体(Component):
def __init__(self):
Component.__init__(self)
self['长'] = Attr(1000.0, obvious=True)
self['宽'] = Attr(1000.0, obvious=True)
self['高'] = Attr(1000, obvious = True)
self['立方体'] = Attr(None, show=True)
self['旋转角度'] = Attr(0,obvious = True)
self['X'] = Attr(0.0, obvious=True)
self['Y'] = Attr(0.0, obvious=True)
self['Z'] = Attr(0.0, obvious=True)
self.replace()
@export
def replace(self):
L = self['长']
W = self['宽']
H = self['高']
x = self['X']
y = self['Y']
z = self['Z']
Angle = self['旋转角度']
TestCube = translate(x,y,z) * rotation(math.pi/180 * Angle) * scale(L,W,H) * Cube()
self['立方体'] = TestCube
if __name__ == "__main__":
FinalGeometry =立方体()
place(FinalGeometry)