sketchucation logo sketchucation
    • Login
    1. Home
    2. riberholt
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 1
    • Groups 1

    riberholt

    @riberholt

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    riberholt Unfollow Follow
    registered-users

    Latest posts made by riberholt

    • RE: [Plugin] Export Batch DAE

      I'm looking for a script that will batch convert files from 3ds to dae format using sketchup.

      I have found this script in an old thread

      #convert skp to obj
      #every thumb is putted in a created dir with name of related skp model's name
      #skppath is the residence of skpfiles
      
      require 'sketchup.rb' 
      if(not file_loaded?("skp2obj.rb")) 
          plugins_menu = UI.menu("Plugins") 
          plugins_menu.add_item("skp2obj") {file_export} 
      end 
      file_loaded("skp2obj.rb") 
      
      
      def file_export 
      
      #skp file path
      #beware the end "/" e.g. skppath ="c;\skp"
      skppath ="C;/Program Files (x86)/Google/Google SketchUp 8/"
      
      #open dir and loop all skps
      dir = Dir.open(skppath)
      begin
        dir.each {|x|
             next if x !~ /\.skp$/i 
             x = "#{x}"
             sourcefile = skppath+x
             x = x[0,x.length-4]
             destdir = skppath + x + "/"
             destfile = destdir + x +".obj"
      
               #mak dir
             Dir.mkdir(destdir)
             
             #open modle file
             Sketchup.file_new
               status = Sketchup.open_file sourcefile
               if (!status) 
                 UI.messagebox "error; " + sourcefile
            end
            
            #export obj
               status = Sketchup.active_model.export destfile
               if (!status) 
                 UI.messagebox "error; " + sourcefile
            end
          }
      ensure
        dir.close
      end
      
          UI.messagebox "Finished" 
      end
      
      
      and tried to modify it to import and export
      #convert skp to dae
      #every thumb is putted in a created dir with name of related skp model's name
      #skppath is the residence of skpfiles
      
      require 'sketchup.rb' 
      if(not file_loaded?("3ds2dae.rb")) 
          plugins_menu = UI.menu("Plugins") 
          plugins_menu.add_item("3ds2dae") {file_export} 
      end 
      file_loaded("3ds2dae.rb") 
      
      
      def file_export 
      
      #skp file path
      #beware the end "/" e.g. skppath ="i;/skp/skptest/model/error/"
      skppath ="C;/skp/"
      
      #open dir and loop all skps
      dir = Dir.open(skppath)
      begin
        dir.each {|x|
             next if x !~ /\.skp$/i 
             x = "#{x}"
             sourcefile = skppath+x
             x = x[0,x.length-4]
             destdir = skppath + x + "/"
             destfile = destdir + x +".dae"
      
               #make dir
             Dir.mkdir(destdir)
             
             #open model file
             Sketchup.file_new
               status = model.import sourcefile
               if (!status) 
                 UI.messagebox "error; " + sourcefile
            end
            
            #export dae
               status = Sketchup.active_model.export destfile
               if (!status) 
                 UI.messagebox "error; " + sourcefile
            end
          }
      ensure
        dir.close
      end
      
          UI.messagebox "Finished" 
      end
      

      But it seems my RubyFU is not strong enough. Any help would be appreciated.

      posted in Plugins
      R
      riberholt