sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Display image using Ruby API

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 4 Posters 341 Views 4 Watching
    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

      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
      • thomthomT Offline
        thomthom
        last edited by

        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

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

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            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
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              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

                "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
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  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
                  • thomthomT Offline
                    thomthom
                    last edited by

                    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

                      Ya, WebDialog is also fine.

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

                      Advertisement