Giving images different name with export image
-
Hi, I'm working on 'export image' by myself and the result was not bad.
Now, I'm trying to export some images with different name. The problem is, I already set up the specific name. I couldn't get next image with different name before I change the name in code.
Maybe, I have to treat the name as variable but don't know how to do
could you please help me with it? Here, I'm sharing the code
require 'sketchup.rb' def exportimage model = Sketchup.active_model entities = model.entities view = model.active_view # Set the camera properties eye = [0, 0, -1000] target = [0, 0, 0] up = [0, 100, 0] # Create the camera and make it active cam = Sketchup;;Camera.new eye, target, up view.camera = cam view.zoom_extents # Set file property keys = { # Naming file ;filename => "c;/temp/_image.png", # Pixel setting ;width => 500, ;height => 500, # Tranparent setting ;transparent => false } view.write_image keys end # def ExportImage #----------------------------------------------------------------------------- if( not file_loaded?("exportimage.rb") ) add_separator_to_menu("Plugins") if $submenu!=nil $submenu.add_item("ExportImage") { exportimage } else UI.menu("Plugins").add_item("ExportImage") { exportimage } end end #----------------------------------------------------------------------------- file_loaded("exportimage.rb")
with the code. All the name of images I produced was '_image'. I would like to get images have different name without changing the line
"c:/temp/_image.png",
in the code. -
you can't not change that line, "c:/temp/_image.png" IS your image name...
each new one will overwrite the previous...
if you want different names that line has to change...
john
-
@unknownuser said:
you can't not change that line, "c:/temp/_image.png" IS your image name...
each new one will overwrite the previous...
if you want different names that line has to change...
john
Then, what if I don't specify an image file path? Only the name and extension of image file will be remained and it looks like it can be treated... using
#{name}
Advertisement