windows11で、sketchup6 その10

# 概要
windows11に、sketchup6を入れてみた。
rubyで、3Dを書く。
FunShapes.rb、見つけたのでやってみた。
inputbox、使ってみた。

# 写真

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/18104/c84daf1c-1bc4-48c0-a430-874e21413ce4.png)

# サンプルコード

```
def superellipse_superellipsoid
	prompt = ["# Iterations : ", "x Scale Factor : ", "y Scale Factor : ", "z Scale Factor : ", "z Squareness : ", "x-y Squareness : "]
	params = [5, 1.0, 1.0, 1.0, 1.0, 3.0]
	result = inputbox(prompt, params, "Imput Superellipse/Superellipsoid Parameters")
	if result
		it = [2, result[0]].max
		rx = [1.0, result[1].abs].max
		ry = [1.0, result[2].abs].max
		rz = [1.0, result[3].abs].max
		n1 = [0.05, result[4].abs].max
		n2 = [0.05, result[5].abs].max
	else
		return
	end
	entities = Sketchup.active_model.entities
	group = entities.add_group
	group_ents = group.entities
	mesh_ss1 = Geom::PolygonMesh.new
	mesh_ss2 = Geom::PolygonMesh.new
	mesh_ss3 = Geom::PolygonMesh.new
	mesh_ss4 = Geom::PolygonMesh.new
	mesh_ss5 = Geom::PolygonMesh.new
	mesh_ss6 = Geom::PolygonMesh.new
	mesh_ss7 = Geom::PolygonMesh.new
	mesh_ss8 = Geom::PolygonMesh.new
	indexes = [0]
	aux_vect = []
	for ind_u in (0..2 * it)
		u = (Math::PI / 2) * ind_u / (2 * it)
		for ind_v in (0..2 * it)
			v = (Math::PI / 2) * ind_v / (2 * it)
			x = rx * (Math::cos(u) ** n1) * (Math::cos(v) ** n2)
			y = ry * (Math::cos(u) ** n1) * (Math::sin(v) ** n2)
			z = rz * (Math::sin(u) ** n1)
			pt = Geom::Point3d.new(1 * x, 1 * y, 1 * z)
			index = mesh_ss1.add_point(pt)
			pt = Geom::Point3d.new(-1 * x, -1 * y, 1 * z)
			index = mesh_ss2.add_point(pt)
			pt = Geom::Point3d.new(-1 * x, 1 * y, -1 * z)
			index = mesh_ss3.add_point(pt)
			pt = Geom::Point3d.new(1 * x, -1 * y, -1 * z)
			index = mesh_ss4.add_point(pt)
			pt = Geom::Point3d.new(1 * x, 1 * y, -1 * z)
			index = mesh_ss5.add_point(pt)
			pt = Geom::Point3d.new(-1 * x, -1 * y, -1 * z)
			index = mesh_ss6.add_point(pt)
			pt = Geom::Point3d.new(-1 * x, 1 * y, 1 * z)
			index = mesh_ss7.add_point(pt)
			pt = Geom::Point3d.new(1 * x, -1 * y, 1 * z)
			index = mesh_ss8.add_point(pt)
			indexes.push(index)
		end
	end
	for ind_u in (1..2 * it)
		for ind_v in (1..2 * it)
			aux_ind = (2 * it + 1) * (ind_u - 1) + ind_v
			aux_vect = [indexes[aux_ind], indexes[aux_ind + 1], indexes[aux_ind + 1 + 2 * it]]
			mesh_ss1.add_polygon(aux_vect)
			mesh_ss2.add_polygon(aux_vect)
			mesh_ss3.add_polygon(aux_vect)
			mesh_ss4.add_polygon(aux_vect)
			aux_vect = [indexes[aux_ind], indexes[aux_ind + 1 + 2 * it], indexes[aux_ind + 1]]
			mesh_ss5.add_polygon(aux_vect)
			mesh_ss6.add_polygon(aux_vect)
			mesh_ss7.add_polygon(aux_vect)
			mesh_ss8.add_polygon(aux_vect)
			aux_vect = [indexes[aux_ind + 1], indexes[aux_ind + 2 + 2 * it], indexes[aux_ind + 1 + 2 * it]]
			mesh_ss1.add_polygon(aux_vect)
			mesh_ss2.add_polygon(aux_vect)
			mesh_ss3.add_polygon(aux_vect)
			mesh_ss4.add_polygon(aux_vect)
			aux_vect = [indexes[aux_ind + 1], indexes[aux_ind + 1 + 2 * it], indexes[aux_ind + 2 + 2 * it]]
			mesh_ss5.add_polygon(aux_vect)
			mesh_ss6.add_polygon(aux_vect)
			mesh_ss7.add_polygon(aux_vect)
			mesh_ss8.add_polygon(aux_vect)
		end
	end
	group_ents.add_faces_from_mesh(mesh_ss1)
	group_ents.add_faces_from_mesh(mesh_ss2)
	group_ents.add_faces_from_mesh(mesh_ss3)
	group_ents.add_faces_from_mesh(mesh_ss4)
	group_ents.add_faces_from_mesh(mesh_ss5)
	group_ents.add_faces_from_mesh(mesh_ss6)
	group_ents.add_faces_from_mesh(mesh_ss7)
	group_ents.add_faces_from_mesh(mesh_ss8)
end

```

以上。