Close model
-
It is possible to save the current model to a file. It is possible to
open a new model from a file. I can't see a way to close the current
model. -
http://code.google.com/apis/sketchup/docs/ourdoc/model.html#save
http://code.google.com/apis/sketchup/docs/ourdoc/sketchup.html#open_fileYou can't use the current model's name in a save, as that gives an error as it's in use - but you can save it as a temp-name then delete the original SKP [File.delete() etc] then do another save with the original name and erase the temp file... That way it's like you saved the file from the File menu...
See my Archiver tool that does this kind of thing - it has to save the current SKP as something else then open the original in a twinkling of an eye...
-
-
Thanks for help, this is the result:
def zeichnung_starten() model = Sketchup.active_model require "ftools" prompts = ["neue Planung starten ","neuer Dateiname"] defaults = ["Raum","Test"] list = ["Raum|Tische|Schraenke|Standard"] input = UI.inputbox prompts, defaults, list, "Planung neu" datei = input[0] datei_neu = input[1].to_s directory = "/Library/Application\ Support/Google\ SketchUp\ 8/SketchUp/plugins/mo_mo_moebel/Vorlagen" weg = directory + "/"+ datei + ".skp" neu = "/Users/Benutzer/Planungen\ aktuell/" + datei_neu + ".skp" File.copy(weg, neu) result = Sketchup.open_file neu end
-
your
directory
ref is OSX only. It's different on PC.use this for lines 11..13:
` subdir = 'mo_mo_moebel/Vorlagen'
plugdir = File.expand_path( Sketchup.find_support_file('plugins') )
weg = File.join( plugdir, subdir, "#{datei.to_s}.skp" )usrdir =( RUBY_PLATFORM =~ /(darwin)/ ? ENV['HOME'] : ENV['USERPROFILE'] )
usrdir = File.expand_path( usrdir )
neu = File.join( usrdir, 'Planungen aktuell', "#{datei_neu}.skp" )` -
There is an error "stack level to deep" after line "File.copy(...)".
Who can help me?
Advertisement