• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Display image using Ruby API

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 4 Posters 341 Views
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.
  • B Offline
    blue_orchid
    last edited by 22 Feb 2012, 18:33

    Can anyone tell me how to display an image which is located in other directory using Ruby API in SketchUP?

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 22 Feb 2012, 19:22

      Add an Image entity? Or add a material with a texture?

      @blue_orchid said:

      located in other directory

      Other than what?

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • B Offline
        blue_orchid
        last edited by 22 Feb 2012, 19:38

        What I wanted to do is display an image after I click the object.

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 22 Feb 2012, 19:45

          Please don't 'report' a post when you mean to 'reply' 😒

          OK... back to your 'question'...

          What 'object' do you want to click ?

          It is quite possible to add an Image to a SKP... or use an image-file as a texture for a new material in a SKP [and use it on a face]...
          So, do you perhaps mean to use an image as a new textured-material on a selected [clicked?] face ?
          How are you expecting to determine this 'image' size/scaling/orientation etc...

          More info needed for a definitive response...
          😕

          TIG

          1 Reply Last reply Reply Quote 0
          • D Offline
            Dan Rathbun
            last edited by 22 Feb 2012, 20:25

            AND.. by "other directory"... do you mean:

            1) other than the directory that the model is saved in ?

            2) other than the "images" directory used by SketchUp ?

            Note that in Ruby, you can always specify an absolute full filepath (as long as there are no multibyte unicode characters in the path for PC.)
            Or you can change the current working directory.. via:

            ` prevdir = Dir.getwd
            Dir.chdir( "C:/some/path/to/imagedir" )

            do your file handling command

            Dir.chdir( prevdir )`

            When Ruby (and Sketchup,) starts up, the current working dir, is set to the user's profile folder, which is ENV['USERPROFILE'] (on PC,) or ENV['HOME'] (on the Mac.)
            It is always a good idea to save it, and restore it when your done using another working directory, .. or else possibly another plugin may "lose it's way" if the author did not write his/her path handling in a defensive manner. (as shown above.)

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • B Offline
              blue_orchid
              last edited by 24 Feb 2012, 17:32

              "Directory" means just the folder in your computer.

              What I wanted to do: On clicking dynamic component, image should pop up.

              1 Reply Last reply Reply Quote 0
              • T Offline
                TIG Moderator
                last edited by 24 Feb 2012, 18:06

                Is this Image one of several in the DC ?
                If so you just hide them all except the one wanted OR have an onClick to unhide the Image wanted ???

                TIG

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 24 Feb 2012, 18:21

                  You mean open a window with an image - like a WebDialog?

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    blue_orchid
                    last edited by 24 Feb 2012, 18:26

                    Ya, WebDialog is also fine.

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

                    Advertisement