==== 基本コード ====
rs.BooleanDifference(input0, input1, delete_input=True) # 差
rs.BooleanIntersection(input0, input1, delete_input=True) # 交差
rs.BooleanUnion(input, delete_input=True) # 和
*API [[https://developer.rhino3d.com/api/RhinoScriptSyntax/#surface-BooleanDifference|BooleanDifference]]
*API [[https://developer.rhino3d.com/api/RhinoScriptSyntax/#surface-BooleanIntersection|BooleanIntersection]]
*API [[https://developer.rhino3d.com/api/RhinoScriptSyntax/#surface-BooleanUnion|BooleanUnion]]
==== サンプルコード1 ====
2つの球の差を求める
import rhinoscriptsyntax as rs
a = []
s0 = rs.AddSphere([0,0,0], 50)
s1 = rs.AddSphere([40,0,0], 40)
a.extend(rs.BooleanDifference(s0, s1))
実行結果
{{:diff.png?direct|}}
{{:diff2.png?direct|}}
==== サンプルコード2 ====
円柱の表面から複数の球を引き算する
a = []
s0 = rs.AddCylinder([0,0,-50], [0,0,50], 100)
DIV_NUM = 12
for i in range(DIV_NUM):
angle = math.radians(i * 360 / DIV_NUM)
s1 = rs.AddSphere([100*math.cos(angle),100*math.sin(angle),0], 20)
s0 = rs.BooleanDifference(s0, s1)
a.extend(s0)
実行結果
{{:diff3.jpg?direct|}}