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

Last updated at Posted at 2025-04-13

概要

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

練習問題

solidを判定するRUBYスクリプトを書け。

写真

image.png

サンプルコード


def is_solid?(group_or_component)
	entities = group_or_component.entities
	edges = entities.grep(Sketchup::Edge)
	edges.all? { |edge| 
		edge.faces.size == 2 
	}
end


def solid0
	entities = Sketchup.active_model.entities
	group0 = entities.add_group
	c0 = group0.entities.add_circle [0, 0, 0], [0, 0, 7], 20
	circle0 = group0.entities.add_face c0
	circle0.pushpull -10
	group1 = entities.add_group
	c1 = group1.entities.add_circle [0, 10, 0], [0, 0, 7], 20
	circle1 = group1.entities.add_face c1
	circle1.pushpull -10
	gr = is_solid? group0
	UI.messagebox gr
	gr = is_solid? group1
	UI.messagebox gr
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?