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

Can Objects Have Hyperlinks?

Scheduled Pinned Locked Moved Developers' Forum
10 Posts 4 Posters 5.7k 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.
  • G Offline
    Greg
    last edited by 29 Feb 2008, 17:03

    Hello,

    Is there a way to add a hyperlink to an object that launches another ruby plug-in?

    If not, is there a way to add a hyperlink to an object in general? Is so, how is such a hyperlink used?

    Thank you.

    Greg

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 29 Feb 2008, 17:20

      Didier has written a hyper-linking script called links.rb. That adds url type links to selected objects as Attributes through the context menu, and then lets you open them etc, BUT since we know that the url specified can be an executable (full path to .exe) then you could use his code as a basis and link things to other apps ? It works because I just got a linked group to open a text editor... Don't think you can make a 'button' you click but...
      Try: http://www.crai.archi.fr/rubylibrarydepot/ruby/links.rb

      TIG

      1 Reply Last reply Reply Quote 0
      • G Offline
        Greg
        last edited by 29 Feb 2008, 17:25

        Thanks TIG,

        I'll look at that now.

        Greg

        1 Reply Last reply Reply Quote 0
        • G Offline
          Greg
          last edited by 29 Feb 2008, 22:54

          Hello,

          I'm getting the following error when I attempt to add an attribute:

          Error: #<NoMethodError: undefined method `attribute_dictionary' for nil:NilClass>

          Here is the code snippet:

          %(#8000FF)[# test code start
          model=Sketchup.active_model
          e = model.selection[0]
          dict_name="link_data"
          dict_key_url="http://www.inventoryPalletDetailTest.com"
          e.attribute_dictionary(dict_name, true)
          e.set_attribute(dict_name,"url",dict_key_url)

          test code stop]

          What is the syntax for defining attribute methods?

          Thank you.

          Greg

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by 29 Feb 2008, 23:53

            @greg said:

            Hello,

            I'm getting the following error when I attempt to add an attribute:

            Error: #<NoMethodError: undefined method `attribute_dictionary' for nil:NilClass>

            Here is the code snippet:

            %(#8000FF)[# test code start
            model=Sketchup.active_model
            e = model.selection[0]
            dict_name="link_data"
            dict_key_url="http://www.inventoryPalletDetailTest.com"
            e.attribute_dictionary(dict_name, true)
            e.set_attribute(dict_name,"url",dict_key_url)

            test code stop]

            What is the syntax for defining attribute methods?

            Thank you.

            Greg

            Here's hint:

            attribute_dictionary is being called on e, which is nil. Why is e nil?

            Hi

            1 Reply Last reply Reply Quote 0
            • G Offline
              Greg
              last edited by 1 Mar 2008, 04:06

              Right, I had too much code. This works:

              %(#FF0080)[# front plane
              pt1 = Geom::Point3d.new(x,y,z)
              pt2 = Geom::Point3d.new(x+w,y,z)
              pt3 = Geom::Point3d.new(x+w,y,z+h)
              pt4 = Geom::Point3d.new(x,y,z+h)
              edges[0] = entities.add_line(pt1, pt2)
              edges[1] = entities.add_line(pt2, pt3)
              edges[2] = entities.add_line(pt3, pt4)
              edges[3] = entities.add_line(pt4, pt1)
              face = entities.add_face edges
              face.material = m

              test code start

              dict_name="link_data"
              dict_key_url="http://www.inventoryPalletDetailTest.com"
              face.attribute_dictionary(dict_name, true)
              face.set_attribute(dict_name,"url",dict_key_url)

              test code stop]

              Thanks Jim.

              Greg

              1 Reply Last reply Reply Quote 0
              • G Offline
                Greg
                last edited by 2 Mar 2008, 05:58

                Hello,

                Is there a way to pass a parameter to .exe file run by the openURL?

                For example the following code works:

                %(#FF0080)[dict_key_url="c://gfTest01.exe"
                UI.openURL(dict_key_url)]

                But it does not work when I add a parameter:

                %(#FF0080)[dict_key_url="c://gfTest01.exe?x=123"
                UI.openURL(dict_key_url)]

                Thank you.

                Greg

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 2 Mar 2008, 12:25

                  It seems you can't pass parameters directly that way BUT since you are on a PC you can write a batch file (.bat) into your temp folder and then call that with the script to run an exe with parameters - here I use a text editor BUT could be anything. Note start "" needed to close command prompt window immediately...

                  tbat="c;/temp/my_temp.bat"
                  file=File.new(tbat,"w")
                  file.puts("start \"\" \"C;/Program Files/Notepad++/Notepad++.exe\" ")
                  ### add parameters after the exe, using acceptable syntax for that exe; keep "" around any paths etc with spaces in...
                  file.close
                  UI.openURL(tbat)
                  
                  

                  ...

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    Greg
                    last edited by 2 Mar 2008, 22:27

                    Thanks TIG, I'll add this code and evaluate.

                    Greg

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      crladner
                      last edited by 19 Mar 2008, 13:51

                      I have been reviweing the posts on this site and wanted to ask you a few questions:

                      I am trying to provide a graphical "report" to a customer in lieu of the traditional 3-ring binder. I want to provide a secure web-link or CD to my customer that will allow them to view their facility, hyperlink to floorplans, piping plans, and other non-graphical documents. I feel this would be more usefull and , hopefully, allow them to continually update the information.

                      Is SketchUp the right program for this? Thanks for your time.

                      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