sketchucation logo sketchucation
    • Login
    โ„น๏ธ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    User defined DC functions

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    23 Posts 6 Posters 5.4k Views 6 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.
    • D Offline
      Dhruv
      last edited by

      I wanted to know one thing, can I define my onClick openURL function in DC? Can I define my own functions in DC? if so where do I do it? I don't whether imageURL does the same thing. Can somebody please clarify this?

      Thanks,
      Dhruv

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        Hi Dhruv, unfortunately it is not that easy at this point. There is no direct way to make the onclick go to a URL. As I understand it, there is serious safety concerns with that particular function. Hopefully we'll throw caution to the wind and eventually just let it be a part of DC's in the future.

        I know people are working on small ruby scripts that can add to the functionality of DC's - this specific idea is being worked on. But so far unsuccessfully as far as I know. Hopefully the ability to control DC's better through rubies will get better shortly.

        However, even if someone does write a script that allows you to add a URL to the onclick, the end user of your DC would also need that same script installed for the onclick to actually work. So its really a bit of a bummer.

        Chris

        PS. This is a very active forum. Many of use read every post on the forum. Or at least every post in the forums we are interested in. There really is no need to duplicate your post so many times, it will be seen even if it gets posted just once in the right spot. So please keep DC questions in the DC forum (I already moved this thread to the DC forum for you). And please don't "spam" the forum with multiple posts of the same question. Thanks and good luck! These DC's are a ton of fun.

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dhruv
          last edited by

          There is one links.rb plugin , which does open url but thats by right clicking on an object , but I want left clicking. What I am trying to say is that you can set links from before through DC function like onClick(" window.open("www.google.com")"); something like this. There is no threat in this. All I am asking that I want objects to act as hyperlinks. I am just trying to figure out ,how to implement it through dc components?

          1 Reply Last reply Reply Quote 0
          • Chris FullmerC Offline
            Chris Fullmer
            last edited by

            Hi Dhruv, I understand completely. Again, it is currently not possible. You can't do it. It is not built in to the program.

            Ruby scripts and DC's are different things - sort of. So just because you have a ruby script that adds left click url ability does not mean that someone can make a DC do it how you would like. Not yet at least. Like I said, it is being worked on, and I'm sure it will happen eventually. But currently, its not possible

            Chris

            Lately you've been tan, suspicious for the winter.
            All my Plugins I've written

            1 Reply Last reply Reply Quote 0
            • D Offline
              Dhruv
              last edited by

              Can anybody tell me how imageURL works?

              1 Reply Last reply Reply Quote 0
              • R Offline
                remus
                last edited by

                You put in the URL of an image on the internet, or from a local hard rive and then it will be displayed in the component options dialog.

                I think you can use some basic html in the description field, so you could always use that to add an image to your description.

                http://remusrendering.wordpress.com/

                1 Reply Last reply Reply Quote 0
                • D Offline
                  Dhruv
                  last edited by

                  Hey Remus,

                  Can you show me a example? That would be really helpful!

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    remus
                    last edited by

                    Well i tried it out, and using html to link to an image doesnt work unfortunately.

                    This should show how to link to an image using the imageURL attribute.


                    image link DC.skp

                    http://remusrendering.wordpress.com/

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      Dhruv
                      last edited by

                      Can you show me how do I use imageURL with onClick function?

                      Thanks a lot!
                      Dhruv

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        remus
                        last edited by

                        What sort of thing would you like to achieve? i think i can think of a way to change the picture on click, but your pretty limited in what you can do.

                        http://remusrendering.wordpress.com/

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          Dhruv
                          last edited by

                          I am trying to open a hyperlink basically, when user clicks I want it to direct to web-browser.

                          1 Reply Last reply Reply Quote 0
                          • R Offline
                            remus
                            last edited by

                            Im not really sure how the imageURL attribute is going to help with that ๐Ÿ˜‰

                            http://remusrendering.wordpress.com/

                            1 Reply Last reply Reply Quote 0
                            • Chris FullmerC Offline
                              Chris Fullmer
                              last edited by

                              Yeah, Dhruv the imageurl won't work with onclick. THe ONLY thing it is used for is to include a url for an image that will display itself in the component options box. The image never pops up or anything. It only displays when someone opens the options window.

                              So unfortunately there is no way to do what you want with the imageurl and onclick. Though that is good thinking, its just not built to do that.

                              Chris

                              Lately you've been tan, suspicious for the winter.
                              All my Plugins I've written

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                Dhruv
                                last edited by

                                Thanks Chris and Remus for your support ๐Ÿ˜„

                                1 Reply Last reply Reply Quote 0
                                • scottliningerS Offline
                                  scottlininger
                                  last edited by

                                  Hey Dhruv,

                                  Just to add some "official" notes to your question:

                                  There is no way (currently) to open URLs from an onclick interaction because of security/privacy concerns. We didn't want people spamming you with nasty website links that launch in your browser without you even knowing that a link was coming.

                                  What we do allow is for html links that originate from inside the Component Options window. Just add something like this to your "description" attribute:

                                  Click here to <a href="http://mysite.com">Visit my site</a>.
                                  

                                  Then anyone selecting your component while the Component Options window is open will see your link.

                                  It's not as sexy or simple as how you're requesting, but it provides that buffer that we felt was important... if you click on the link you don't know where it's taking you, but at least you knew it was a link.

                                  • Scott Lininger
                                    SketchUp Software Engineer
                                    Have you visited the Ruby API Docs?
                                  1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    Dhruv
                                    last edited by

                                    Thanks Scott ๐Ÿ˜„

                                    1 Reply Last reply Reply Quote 0
                                    • K Offline
                                      kelvins
                                      last edited by

                                      Any chance that this can be adapted for opening a pdf saved in a common network folder?

                                      1 Reply Last reply Reply Quote 0
                                      • Chris FullmerC Offline
                                        Chris Fullmer
                                        last edited by

                                        I thought it would work just by replacing the internet url with a file version like:

                                        file:///C:/Program%20Files/Google/Google%20SketchUp%207/Tools/Sandbox/images/tbflipperlarge.png

                                        That did not work though. So I'm guessing they manually disabled linking to anything other than internet links. Porbably a pretty major security risk.

                                        Chris

                                        Lately you've been tan, suspicious for the winter.
                                        All my Plugins I've written

                                        1 Reply Last reply Reply Quote 0
                                        • K Offline
                                          kelvins
                                          last edited by

                                          I tried this as well.
                                          Avoiding the the security risk is appreciated, but the function that we are missing here has incredible potential.
                                          To be able to have a 3D model as a visualization tool and for means of referencing to pdf documents and other files/programs would be the case study of case studies.

                                          I suppose I am stuck with using the ruby script URL. Just have to make sure that others have it installed as well.

                                          I guess I could post the documents to a website, but that increases my security risks.

                                          Don't know what to do, any suggestions?

                                          1 Reply Last reply Reply Quote 0
                                          • scottliningerS Offline
                                            scottlininger
                                            last edited by

                                            That's a tough one. We chatted about allowing local files to be opened, but there are all kinds of security concerns with that, so we dropped it from V1.

                                            I've added a feature request to our list so we can revisit it for future versions.

                                            In the short term, might a password-protected web repository be suitable? You could give a password out to all of your users that allows them to get at the PDFs. If you set up the login to be cookie-enabled, they would only have to log in once and then could get at all of your resources.

                                            • Scott Lininger
                                              SketchUp Software Engineer
                                              Have you visited the Ruby API Docs?
                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement