3.轉換成\(SketcuUp\)程式碼
ent=Sketchup.active_model.entities
center=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1]]
normal=[[2,2,2],[-2,2,2],[-2,-2,2],[2,-2,2]]
for i in 0..3
circle=ent.add_circle center[ i ],normal[ i ],1,60
circle_face=ent.add_face circle
circle_face.pushpull 4
ent.add_group circle_face.all_connected
end
程式碼解釋可以看底下參考資料的"當SketchUp遇見Ruby-邁向程式化建模之路"
轉換成\(SketcuUp\)程式碼
ent=Sketchup.active_model.entities
center=[[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[0,-1,1],[0,-1,-1]]
normal=[[-2,2,0],[2,2,0],[-2,0,-2],[2,0,-2],[0,2,-2],[0,2,2]]
for i in 0..5
circle=ent.add_circle center[ i ],normal[ i ],1,60
circle_face=ent.add_face circle
circle_face.pushpull 3
ent.add_group circle_face.all_connected
end
其餘部分就和前面相同
但交集後的模型在6條線的交點處會有折線或斷線,這是比較可惜的地方