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 その104

Posted at

概要

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

練習問題

九九をアニメーションせよ。

写真

image.png

サンプルコード


class Kuku2
	def initialize
		model = Sketchup.active_model
		@entities = model.active_entities
		coordinates = [10, 10, 10]
		@point = Geom::Point3d.new coordinates
		@text = @entities.add_text "This is a Test", @point
		@group = @entities.add_group
		pts = []
		pts[0] = [0.5, 0.5, 0.5]
		pts[1] = [  1, 0.5, 0.5]
		pts[2] = [  1,   1, 0.5]
		pts[3] = [0.5,   1, 0.5]
		base = @group.entities.add_face pts
		base.pushpull 0.5
		@k = 0
		@tid = UI.start_timer(2.9, true) {
			tick
		}
	end
	def tick
		@text.erase!
		@group.erase!
		i = Integer(@k / 9) + 1
		j = @k % 9 + 1
		@text = @entities.add_text "#{i}x#{j}=#{i * j}", @point
		@group = @entities.add_group
		(1..i).each { |x| 
			(1..j).each { |y| 
				puts "#{x} #{y}"
				pts = []
				pts[0] = [x + 0.5, y + 0.5, 0.5]
				pts[1] = [x +   1, y + 0.5, 0.5]
				pts[2] = [x +   1, y +   1, 0.5]
				pts[3] = [x + 0.5, y +   1, 0.5]
				base = @group.entities.add_face pts
				base.pushpull 0.5
			}
		}
		@k += 1
	end
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?