windows11で、sketchup6 その39

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

# 練習問題
sketchupで、サイコロを描くrubyスクリプトは

# 写真

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/5de1ab50-355a-4fea-80f8-f1912b922546.png)

# サンプルコード

```

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
#1
	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

#6
	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

#2
	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

#5
	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

#3
	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

#4
	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

```


以上。