rs.CreateColor(r,g,b,a)
rs.ColorHLSToRGB( (160, 120, 0) )
※ 変数の範囲についてはAPIに書かれていないのでよくわからないHの値は通常は0~360のはずだけど、試してみると0~180で指定するっぽい。LとSについても同様によくわからないけど0~360の範囲っぽい?
import rhinoscriptsyntax as rs import random def box2pt(p1, p2): pt0 = p1 pt1 = rs.coerce3dpoint([p2[0], p1[1], p1[2]]) pt2 = rs.coerce3dpoint([p2[0], p2[1], p1[2]]) pt3 = rs.coerce3dpoint([p1[0], p2[1], p1[2]]) pt4 = rs.coerce3dpoint([p1[0], p1[1], p2[2]]) pt5 = rs.coerce3dpoint([p2[0], p1[1], p2[2]]) pt6 = p2 pt7 = rs.coerce3dpoint([p1[0], p2[1], p2[2]]) return rs.AddBox([pt0, pt1, pt2, pt3, pt4, pt5, pt6, pt7]) N = 100 cubes = [] colors = [] for i in range(N): p0 = [random.randint(0,300) for i in range(3)] p1 = [random.randint(30,50) for i in range(3)] p2 = [p0[i] + p1[i] for i in range(3)] cubes.append(box2pt(p0, p2)) r = random.randint(0,255) g = random.randint(0,255) b = random.randint(0,255) a = random.randint(0,255) colors.append(rs.CreateColor(r,g,b,a))
import rhinoscriptsyntax as rs import math N = 30 spheres = [] colors = [] for j in range(8): r = 2 * (j+3)+15 R = 40 * j for i in range(N): angle = 360 * i / N print(int(angle)) print(math.radians(angle)) x = R * math.cos(math.radians(angle)) y = R * math.sin(math.radians(angle)) spheres.append(rs.AddSphere((x,y,0), r)) colors.append(rs.ColorHLSToRGB( (int(angle/2), 280 - j * 20, 200) ))