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

Posted at

概要

windows11に、sketchup6を入れてみた。
rubyで、3Dを書く。

練習問題

プリミティブを作れ。

写真

image.png

サンプルコード


require 'sketchup.rb'

def create_cube
	model = Sketchup.active_model
	entities = model.active_entities
	unit = 5
	p = Array.new
	p[0] = ORIGIN
	p[1] = [unit, 0, 0]
	p[2] = [unit, unit, 0]
	p[3] = [0, unit, 0]
	face = entities.add_face p
	face.reverse! if face.normal.z < 0
	face.pushpull unit
end

def create_cylinder
	model = Sketchup.active_model
	entities = model.active_entities
	h = 5
	r = 5
	n = 24
	circleBase = entities.add_circle(ORIGIN, Z_AXIS, r, n)
	base = entities.add_face(circleBase)
	base.pushpull h
end

def create_sphere
	model = Sketchup.active_model
	entities = model.active_entities
	r = 5
	n = 24
	circleBase1 = entities.add_circle(ORIGIN, Z_AXIS, r, n)
	circleBase2 = entities.add_circle(ORIGIN, X_AXIS, r, n)
	base = entities.add_face(circleBase1)
	status = base.followme(circleBase2)
end

def create_torus
	model = Sketchup.active_model
	entities = model.active_entities
	num_segments = 24
	center_radius = 5
	thickness = 1
	origin = [0, center_radius, 0]
	circle = entities.add_circle(origin, X_AXIS, thickness, num_segments)
	face = entities.add_face(circle)
	path = entities.add_circle(ORIGIN, Z_AXIS, center_radius, num_segments)
	face.followme(path)
end

def shapes
	puts "create_cube"
	puts "create_cylinder"
	puts "create_sphere"
	puts "create_torus"
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?