sketchucation logo sketchucation
    • Login
    1. Home
    2. ccsing
    ⌛ Sale Ending | 30% Off Profile Builder 4 ends 30th September
    C
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 1
    • Groups 1

    ccsing

    @ccsing

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

    ccsing Unfollow Follow
    registered-users

    Latest posts made by ccsing

    • RE: Looking for a batch export .skp to .dxf ruby
      
      #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 ="i;/skp/skptest/model/error/"
      skppath ="i;/tt/"
      
      #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
      
      
      posted in Plugins
      C
      ccsing