メタセコイアでのPython script練習、繰り返しを使っていない面倒な記述をしていますが、原理を理解するために書いてみた。いろいろと課題はあるけど、Metasequoia Python API勉強です。メタセコイアマスターガイドを参考にしました。ありがとうございます。
#kaku5.py
segment = 5
radius=200.0
from math import *
crad = pi / 180 * 45
irad = 2*pi/segment
doc = MQSystem.getDocument()
segment = 5
radius=200.0
from math import *
crad = pi / 180 * 45
irad = 2*pi/segment
doc = MQSystem.getDocument()
obj = MQSystem.newObject()
obj.name = "polygon_%d" % segment
v=[]
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
crad = crad+irad
v.append(obj.addVertex( MQSystem.newPoint( 0.0, 100.0, 0.0 ) )) #中心
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
obj.addFace(v)
v=[]
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
crad = crad+irad
v.append(obj.addVertex( MQSystem.newPoint( 0.0, 100.0, 0.0 ) ))
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
obj.addFace(v)
v=[]
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
crad = crad+irad
v.append(obj.addVertex( MQSystem.newPoint( 0.0, 100.0, 0.0 ) ))
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
obj.addFace(v)
v=[]
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
crad = crad+irad
v.append(obj.addVertex( MQSystem.newPoint( 0.0, 100.0, 0.0 ) ))
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
obj.addFace(v)
v=[]
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
crad = crad+irad
v.append(obj.addVertex( MQSystem.newPoint( 0.0, 100.0, 0.0 ) ))
v.append(obj.addVertex( MQSystem.newPoint( radius*sin(crad), 0.0, radius*cos(crad) ) ))
obj.addFace(v)
doc.addObject( obj )