sketchucation logo sketchucation
    • Login
    1. Home
    2. Travis_K
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    T
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 1

    Travis_K

    @Travis_K

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

    Travis_K Unfollow Follow
    registered-users

    Latest posts made by Travis_K

    • Newbie switching active models

      I am trying to create a set of thumbnails (600px x 600px) for several thousand .3ds files by importing each file then write a image. I can create a thumb for a single .3ds file without any difficulties. However when I try to batch the process sketchup will not switch the focus from the first imported model and all resulting thumbnails are identical to the first image / model.

      Any help would be much appreciated!

      #######################################
      require 'sketchup'
      Sketchup.send_action "showRubyPanel:"

      def import_3ds(file)
      model = Sketchup.active_model
      model.import file, false
      m_def = model.definitions
      location = Geom::Point3d.new 0,0,0
      entities = Sketchup.active_model.active_entities
      instance = entities.add_instance m_def[0], location
      thumb = file.gsub "3ds", "jpg"
      view = model.active_view.zoom_extents
      view.write_image thumb, 600, 600, true
      entities.erase_entities entities[0]
      model.close_active # this will return false
      end

      UI.menu("PlugIns").add_item("Create Thumb") {
      Dir.glob("C:/models/3ds/*.3ds") do |file|
      import_3ds(file)
      end
      }

      posted in Developers' Forum
      T
      Travis_K