Creating a web Dialog instance named "wd". Define its features. In Web Dialog, enter values for variables "depth" and "width". Next, tell to the program : Form the surfaces in three - dimensional space and duplicate the generated circle along the z - axis.
require 'sketchup.rb'
wd=UI::WebDialog.new( "Rack Drawing", true, "", 300, 300, 100, 100, false )
wd.add_action_callback("first_ac") do |js_wd, message|
depth = message.to_i*39.39
width = message.to_i*39.39
model = Sketchup.active_model
entities = model.active_entities
# Add the face to the entities in the model
face = entities.add_face([0, 0, 0],[width, 0, 0],[width, depth, 0],[0, depth, 0])
face_2 = entities.add_face([0, 0, 0],[width/4, 0, 0],[width/4, depth, 0],[0, depth, 0])
face_3 = entities.add_face([0, 0, width],[width/4, 0, width],[width/4, depth, width],[0, depth, width])
face_4 = entities.add_face([0, 0, width],[width, 0, width],[width , depth, width],[0, depth, width])
face_5 = entities.add_face([0, 0, 0],[width, 0, 0],[width , 0 , width],[0, 0, width])
face_6 = entities.add_face([0, width, 0,],[width, width, 0],[width , width , width],[0, width, width])
face_2.pushpull(-width)
for x in 1..width do
center_point = Geom::Point3d.new(0,0,x)
normal_vector = Geom::Vector3d.new(0,0,1)
radius = width/10
entities = Sketchup.active_model.entities
edgearray = entities.add_circle center_point, normal_vector, radius
first_edge = edgearray[0]
arccurve = first_edge.curve
end
for x in 1..width do
center_point = Geom::Point3d.new(0,depth,x)
normal_vector = Geom::Vector3d.new(0,0,1)
radius = width/10
entities = Sketchup.active_model.entities
edgearray = entities.add_circle center_point, normal_vector, radius
first_edge = edgearray[0]
arccurve = first_edge.curve
end
end
wd.set_file( "C:/Program Files/SketchUp/SketchUp 2017/Tools/table.html" )
wd.show()