sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Close model

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 228 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      hermannausowl
      last edited by

      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.

      Wir planen Ihre Büroeinrichtung mit SketchUp. http://www.momo-moebel.de

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        http://code.google.com/apis/sketchup/docs/ourdoc/model.html#save
        http://code.google.com/apis/sketchup/docs/ourdoc/sketchup.html#open_file

        You 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...

        TIG

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          Sketchup.open_file()

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • H Offline
            hermannausowl
            last edited by

            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
            

            Wir planen Ihre Büroeinrichtung mit SketchUp. http://www.momo-moebel.de

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              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" )`

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • H Offline
                hermannausowl
                last edited by

                There is an error "stack level to deep" after line "File.copy(...)".
                Who can help me?


                Stack level.jpg

                Wir planen Ihre Büroeinrichtung mit SketchUp. http://www.momo-moebel.de

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement