Thanks for the quick response. I did as you advised and added in that part of the script and changed ryan's directory to mine but now I get this message:
"Error Loading File batch_exporter.rb
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/batch_exporter.rb:103: parse error, unexpected kEND, expecting $
end#module
^"
This is the "updated script" I've never used this before so I'm not sure I input in everything correctly
# Batch Exporter Driver File
# Author; Carl Anderson
# Email; cwanderson33@gmail.com
# start of our edits
require('sketchup.rb')
module Carls
unless file_loaded?(__FILE__)
UI.menu("Plugins").add_item("Carl's Batch Exporter"){self.batchExporter()}
end
file_loaded(__FILE__)
def self.batchExporter()
# end of our edits
# Instantiate WebDialog
input_dialog = UI;;WebDialog.new("Carl's Batch Exporter", false, "Batch Exporter", 300, 270, 200, 150, true)
# Add callback for sending sending data from Javascript/HTML back to ruby script
input_dialog.add_action_callback("do_batch") {|dialog, params|
# split the arguments on commas
array_params = params.to_s.split(",")
increment = array_params[0]
height = array_params[1]
axis = array_params[2]
filetype = array_params[3]
fileprefix = array_params[4]
# convert strings to floats for math operations
increment1 = increment.to_f
height1 = height.to_f
# get model
model = Sketchup.active_model
# get selected face
#face = Sketchup.active_model.selection.first
# get entities instead of first entity (for mac)
face = Sketchup.active_model.selection
# initialize loop variable
i = 0
loop_count = height1 / increment1
# if export directory doesn't exist, create it
# directory created in folder containing your project file
#my_export_path = Dir.getwd + "/export"
my_export_path = "/Users/giancarlid/Desktop/geosyntec/Exports"
Dir.mkdir(my_export_path) unless File.exists?(my_export_path)
# do a loop
while i < loop_count
# Create transformation to move the selection
if axis == "0"
transformation = Geom;;Transformation.new([increment1,0,0])
elsif axis == "1"
transformation = Geom;;Transformation.new([0,increment1,0])
elsif axis == "2"
transformation = Geom;;Transformation.new([0,0,increment1])
else
UI.messagebox("Fatal Error... code should not have gotten here.")
end
# perform transformation (do the move on the object)
Sketchup.active_model.entities.transform_entities(transformation, face)
# create full filename and pathname
full_filename = my_export_path + "/" + fileprefix + "_" + i.to_s + "." + filetype
# export to file
status = model.export full_filename
# increment loop counter
i = i + 1
end
# alert user that export has completed
UI.beep
UI.messagebox("Exporting Complete!")
}
# Set HTML file to display in window
#input_dialog.set_file "mypage.html"
# Find and show our html file
html_path = Sketchup.find_support_file "batch_exporter_gui.html" ,"Plugins/Batch_Exporter/"
input_dialog.set_file(html_path)
input_dialog.show()
# start of our edits
end
if( not file_loaded?("batch_exporter.rb") )
###UI.menu("Plugins").add_separator
UI.menu("Plugins").add_item("Batch Exporter") { export_batch }
end
###
file_loaded("batch_exporter.rb")
# end of our edits
end#def
end#module
# Batch Exporter Driver File
# Author; Carl Anderson
# Email; cwanderson33@gmail.com
# start of our edits
require('sketchup.rb')
module Carls
unless file_loaded?(__FILE__)
UI.menu("Plugins").add_item("Carl's Batch Exporter"){self.batchExporter()}
end
file_loaded(__FILE__)
def self.batchExporter()
# end of our edits
# Instantiate WebDialog
input_dialog = UI;;WebDialog.new("Carl's Batch Exporter", false, "Batch Exporter", 300, 270, 200, 150, true)
# Add callback for sending sending data from Javascript/HTML back to ruby script
input_dialog.add_action_callback("do_batch") {|dialog, params|
# split the arguments on commas
array_params = params.to_s.split(",")
increment = array_params[0]
height = array_params[1]
axis = array_params[2]
filetype = array_params[3]
fileprefix = array_params[4]
# convert strings to floats for math operations
increment1 = increment.to_f
height1 = height.to_f
# get model
model = Sketchup.active_model
# get selected face
#face = Sketchup.active_model.selection.first
# get entities instead of first entity (for mac)
face = Sketchup.active_model.selection
# initialize loop variable
i = 0
loop_count = height1 / increment1
# if export directory doesn't exist, create it
# directory created in folder containing your project file
#my_export_path = Dir.getwd + "/export"
my_export_path = "/Users/giancarlid/Desktop/geosyntec/Exports"
Dir.mkdir(my_export_path) unless File.exists?(my_export_path)
# do a loop
while i < loop_count
# Create transformation to move the selection
if axis == "0"
transformation = Geom;;Transformation.new([increment1,0,0])
elsif axis == "1"
transformation = Geom;;Transformation.new([0,increment1,0])
elsif axis == "2"
transformation = Geom;;Transformation.new([0,0,increment1])
else
UI.messagebox("Fatal Error... code should not have gotten here.")
end
# perform transformation (do the move on the object)
Sketchup.active_model.entities.transform_entities(transformation, face)
# create full filename and pathname
full_filename = my_export_path + "/" + fileprefix + "_" + i.to_s + "." + filetype
# export to file
status = model.export full_filename
# increment loop counter
i = i + 1
end
# alert user that export has completed
UI.beep
UI.messagebox("Exporting Complete!")
}
# Set HTML file to display in window
#input_dialog.set_file "mypage.html"
# Find and show our html file
html_path = Sketchup.find_support_file "batch_exporter_gui.html" ,"Plugins/Batch_Exporter/"
input_dialog.set_file(html_path)
input_dialog.show()
end
end#def
end#module
Thanks for the help!
Dave