0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

windows11で、sketchup6 その36

Posted at

概要

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

練習問題

sketchupでカラーボックスを描くrubyスクリプトは

写真

image.png

def create_colorbox
	model = Sketchup.active_model
	entities = model.active_entities
	Sketchup.set_status_text "Please wait a little."
	for x in 0..8 do
		for y in 0..8 do
			for z in 0..8 do
				group = entities.add_group
				entitie = group.entities
				pts = []
				pts[0] = [x * 10 +  5, y * 10 +  5, z * 10 + 5]
				pts[1] = [x * 10 + 10, y * 10 +  5, z * 10 + 5]
				pts[2] = [x * 10 + 10, y * 10 + 10, z * 10 + 5]
				pts[3] = [x * 10 +  5, y * 10 + 10, z * 10 + 5]
				base = entitie.add_face pts
				base.pushpull 5
				materials = model.materials
				m = materials.add "joe" + String(x) + String(y)+ String(z)
				m.color = Sketchup::Color.new (x * 32 , y * 32 , z * 32)
				m.alpha = 1.0
				entitie.each{ |e|
					case e
					when Sketchup::Face
						e.material = "joe" + String(x) + String(y)+ String(z)
					end
				}
			end
		end
	end
	UI.beep
end

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?