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

    Posts

    Recent Best Controversial
    • RE: Script to automate Texturing a surface -> Render

      Here's what my input/output folders look like after the script: http://i.imgur.com/9yTBr90.png

      posted in Developers' Forum
      C
      Carpeggio
    • Script to automate Texturing a surface -> Render

      Hey guys,

      New to Ruby and Sketchup. But making do with what resources I find.


      # Ruby Script for Retexturing and Rendering Scene from source directory images.
      # Have top of board game/material selected (Just the top face) before running script.
      
      inputDir = Dir.open "C;/Users/XXXX/Downloads/Notes And Things/Photo_Illustrator_OddandEnds/SketchUp/Gameboard Modeling/TopCovers(Bulk)"
      
      i = 1
      
      inputDir.each do |file|
      	# Process through Sketchup.
      	# Get a handle to the selection set.
      	currentMaterial = Sketchup.active_model.materials.current
      	currentMaterial.texture = File.absolute_path file
      	UI.messagebox(file)
      	# Save Render to outputDir.
      	view = Sketchup.active_model.active_view
      	view.write_image "C;/Users/XXX/Downloads/Notes And Things/Photo_Illustrator_OddandEnds/SketchUp/Gameboard Modeling/Renders/BulkOutput/testImage#{i}.png"
      	i = i + 1
      end
      

      It runs, and produces output write_images. However, the material does not update. I cannot for the life of me figure out why.

      Hoping to see these images get placed onto the model;
      http://i.imgur.com/jXTMik5.png

      but in the output I only see the original texture;
      http://i.imgur.com/XNxZpWt.png

      The script requires that you have the material with the texture selected because of the line 'currentMaterial = Sketchup.active_model.materials.current' selects that.

      In 'currentMaterial.texture = File.absolute_path file' I was hoping to find some syntactical error that would lead to nothing being applied, but I'm not seeing anything.

      I'm taking screenshots right now with view.write_image just for proof of concept, but hopefully I'll upgrade that to one of two things;

      Create a scene per texture, then Batch Render with Vray after all the textures have been put into a respective scene. OR... Render between retextures. I'm not sure which can work.

      posted in Developers' Forum
      C
      Carpeggio
    • 1 / 1