==== 基本コード ====
rs.AddSrfPt([[0,0,0], [100,0,0], [0, 100, 0]]) # 三角
rs.AddSrfPt([[0,0,0], [100,0,0], [100, 100, 0], [0, 100, 0]]) # 四角
API [[https://developer.rhino3d.com/api/RhinoScriptSyntax/#surface-AddSrfPt|AddSrfPt]]
==== サンプルコード1 ====
import rhinoscriptsyntax as rs
a = []
a.append(rs.AddSrfPt([[-100,0,0], [0,0,0], [-100, 100, 0]]))
a.append(rs.AddSrfPt([[0,0,0], [100,0,0], [100, 100, 0], [0, 100, 0]]))
実行結果
{{:tri_square.png?direct|}}
==== サンプルコード2 ====
中心を共有する三角形で円錐モデルを作成する
import rhinoscriptsyntax as rs
import math
a = []
v = [0, 0, 10]
DIV_NUM = 100
R = 100
for i in range(DIV_NUM):
theta0 = math.radians(360.0 * i / DIV_NUM)
theta1 = math.radians(360.0 * (i+1) / DIV_NUM)
alpha0 = theta0 * 6
alpha1 = theta1 * 6
x0 = R * math.cos(theta0)
y0 = R * math.sin(theta0)
z0 = R * 0.1 * math.cos(alpha0)
x1 = R * math.cos(theta1)
y1 = R * math.sin(theta1)
z1 = R * 0.1 * math.cos(alpha1)
a.append(rs.AddSrfPt([v, [x0,y0,z0], [x1, y1, z1]]))
実行結果
{{:cone.png?direct|}}