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

Posted at

概要

windows11に、sketchup6を入れてみた。
rubyで、3Dを書く。
解決できていない、課題がある。

課題

オブジェクトでオブジェクトを削除する。

できた所

オブジェクトでオブジェクトに跡を付ける。

できない所

オブジェクトでオブジェクトの交差を削除する。

写真

image.png

サンプルコード

def cuttest1
	model = Sketchup.active_model
	entities = model.entities
	basegroup = entities.add_group
	basegroupentities = basegroup.entities
	p1 = Geom::Point3d.new(0, 0, 0)
	p2 = Geom::Point3d.new(20, 0, 0)
	p3 = Geom::Point3d.new(20, 1, 0)
	p4 = Geom::Point3d.new(0, 1, 0)
	p5 = Geom::Point3d.new(0, 0, 0)
	points = [p1, p2, p3, p4, p5]
	base = basegroupentities.add_face points
	normal = base.normal
	if normal == [0, 0, -1]
		base = base.reverse!
	end
	base.pushpull 10
	base_trans = basegroup.transformation
	cutgroup = entities.add_group
	cutgroupentities = cutgroup.entities
	p1 = Geom::Point3d.new(5, -1, 5)
	p2 = Geom::Point3d.new(15, -1, 5)
	p3 = Geom::Point3d.new(15, 2, 5)
	p4 = Geom::Point3d.new(5, 2, 5)
	p5 = Geom::Point3d.new(5, -1, 5)
	points = [p1, p2, p3, p4, p5]
	base = cutgroupentities.add_face points
	normal = base.normal
	if normal == [0, 0, -1]
		base = base.reverse!
	end
	base.pushpull 10
	cut_trans = cutgroup.transformation
	cutgroupentities.intersect_with false, cut_trans, basegroup, base_trans, true, basegroup
	basegroup.explode
	UI.messagebox("Click to delete cut group.")
	cutgroup.erase!
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?