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

Posted at

概要

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

練習問題

セレクトされたグループを三面図のように配置するRUBYスクリプトを書け。

写真

image.png

サンプルコード

def sanmen
	ss = Sketchup.active_model.selection
	sents = []
	ss.each { |e|
		sents.push(e)
	}
	copy = Sketchup.active_model.active_entities.add_group(sents)
	copy_a = Sketchup.active_model.active_entities.add_group(sents)
	trans = Geom::Transformation.translation [-40, 0, 0]
	copy_a.transform! trans
	trans = Geom::Transformation.rotation copy_a.bounds.center, X_AXIS, 90.degrees#red
	copy_a.transform! trans
	trans = Geom::Transformation.rotation copy_a.bounds.center, Z_AXIS, 45.degrees
	copy_a.transform! trans
	copy_b = Sketchup.active_model.active_entities.add_group(sents)
	trans = Geom::Transformation.translation [-20, -30, 0]
	copy_b.transform! trans
	trans = Geom::Transformation.rotation copy_b.bounds.center, Y_AXIS, 90.degrees#green
	copy_b.transform! trans
	trans = Geom::Transformation.rotation copy_b.bounds.center, Z_AXIS, 45.degrees
	copy_b.transform! trans
	copy_c = Sketchup.active_model.active_entities.add_group(sents)
	trans = Geom::Transformation.translation [20, -30, 0]
	copy_c.transform! trans
	trans = Geom::Transformation.rotation copy_c.bounds.center, Z_AXIS, 90.degrees#blue
	copy_c.transform! trans
	trans = Geom::Transformation.rotation copy_c.bounds.center, Y_AXIS, 90.degrees
	copy_c.transform! trans
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?