windows11で、sketchup6 その48

# 概要
windows11に、sketchup6を入れてみた。
rubyで、3Dを書く。
練習問題やってみた。

# 練習問題
sketchupで、サイコロを描く、プラグインを書け。

# 写真

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/b18b7567-cb92-401d-bebc-f00c49123af5.png)

# サンプルコード

```


require 'sketchup.rb'

def create_dice
	model = Sketchup.active_model
	entities = model.active_entities
	unit = 6
	p = Array.new
	p[0] = ORIGIN
	p[1] = [unit, 0, 0]
	p[2] = [unit, unit, 0]
	p[3] = [0, unit, 0]
	face = entities.add_face p
	face.reverse! if face.normal.z < 0
	face.pushpull unit
	circle = entities.add_circle([3, 6, 3], Y_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([2, 0, 5], Y_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([2, 0, 3], Y_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([2, 0, 1], Y_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([4, 0, 5], Y_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([4, 0, 3], Y_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([4, 0, 1], Y_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([3, 2, 6], Z_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([3, 4, 6], Z_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([3, 3, 0], Z_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([2, 4, 0], Z_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([2, 2, 0], Z_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([4, 4, 0], Z_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([4, 2, 0], Z_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([0, 3, 3], X_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([0, 2, 2], X_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([0, 4, 4], X_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([6, 2, 4], X_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([6, 2, 2], X_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([6, 4, 4], X_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
	circle = entities.add_circle([6, 4, 2], X_AXIS, 0.5, 24)
	cv_arr = []
	circle.each do |c|
		cv_arr << c.vertices[0]
	end
	face = entities.add_face cv_arr
	face.pushpull -0.1
end

if( not file_loaded?("dice.rb") )
	UI.menu("Draw").add_item("Dice") {
		create_dice
	}
end

file_loaded("dice.rb")




```

以上。