Chris,
Thanks so much for the help, the revised script works beautifully. Proof positive that I was and still am in way over my head.
Rob
Chris,
Thanks so much for the help, the revised script works beautifully. Proof positive that I was and still am in way over my head.
Rob
Hello all,
I'm trying to get from the tutorials into my first ruby plugin and am tantalizingly close but still getting a syntax error at the very end. Here's the code:
require 'sketchup'
Sketchup.send_action "showRubyPanel;"
UI.menu("PlugIns").add_item("Square Organ Pipe 2D")
prompts = [$exStrings.GetString("Internal Width"),
$exStrings.GetString("Internal Depth"),
$exStrings.GetString("Thickness")]
values = [0.inches, 0.inches, 0.inches]
results = inputbox prompts, values, $exStrings.GetString("Pipe internal dimensions and thickness")
internal_width, internal_depth, thickness = results
model = Sketchup.active_model
entities = model.entities
outer_x = (thickness * 2) + internal_width
outer_y = (thickness * 2) + internal_depth
inner_x1 = thickness
inner_x2 = thickness + internal_width
inner_y1 = thickness
inner_y2 = thickness + internal_depth
center_x = thickness + (internal_width * 0.5)
center_y = thickness + (internal_depth * 0.5)
outer_1 = [0,0,0]
outer_2 = [outer_x,0,0]
outer_3 = [outer_x,outer_y,0]
outer_4 = [0,outer_y,0]
inner_1 = [inner_x1, inner_y1, 0]
inner_2 = [inner_x2, inner_y1, 0]
inner_3 = [inner_x2, inner_y2, 0]
inner_4 = [inner_x1, inner_y2, 0]
center = [center_x, center_y, 0]
new_face = entities.add_face outer_1, outer_2, outer_3, outer_4
new_face = entities.add_face inner_1, inner_2, inner_3, inner_4
line = entities.add_line inner_1, center
line = entities.add_line inner_2, center
end
I'm sure I've made some silly beginner's mistake in here. Anyone see it?
FWIW, this is to produce some 2D boxes to assist in laying out the internal design of a pipe organ. They look like this:
...and I need to make nearly three hundred of them in sizes differing down to a thousandth of an inch. Whence the need to automate part of the process.
Thanks,
Rob