I created some code to render a helicopter. Unfortunately, for some blasted reason, most of the scenes are not being rendered correctly. Help!
Edit: ok, never mind. I added "view.camera = pages.selected_page.camera" .. that seemed to fix things. That's pretty odd that the new camera target isn't being copied. Is it a Sketchup 8 bug?
Fixed file:
require 'sketchup.rb'
module Render_isometric
def Render_isometric.do_render
model = Sketchup.active_model
pages = model.pages
layers = model.layers
view = model.active_view
# Set up and get pointers to the appropriate layers.
image_base_name = "osprey"
scenes_extension = ["bottom", "bottom-left", "left", "top-left", "top", "top-right", "right", "bottom-right"]
rotation_extension = ["rotation 1", "rotation 2", "rotation 3", "rotation 4", "rotation 5", "rotation 6", "rotation 7", "rotation 8"]
rotors_extension = ["rotors forward", "rotors up"]
for i in (0 .. scenes_extension.length - 1)
pages.selected_page = pages[scenes_extension[i]]
view.camera = pages.selected_page.camera
pages.selected_page.transition_time = 0
pages.selected_page.delay_time = 0
for j in (0 .. rotation_extension.length - 1)
current_rotation_layer = layers[rotation_extension[j]]
current_rotation_layer.visible = true
for k in (0 .. rotors_extension.length - 1)
current_rotors_layer = layers[rotors_extension[k]]
current_rotors_layer.visible = true
keys = {
;filename => "c;/vehicles/" + image_base_name + "-" + scenes_extension[i] + "-" + rotation_extension[j] + "-" + rotors_extension[k] + ".png",
;width => 256,
;height => 256,
;antialias => true,
;transparent => true
}
model = Sketchup.active_model
view = model.active_view
view.write_image keys
current_rotors_layer.visible = false
end
current_rotation_layer.visible = false
end
end
end
end #end module
Render_isometric_menu = UI.menu("Plugins").add_submenu("Render Isometric")
Render_isometric_menu.add_item("Do Render") {Render_isometric.do_render}