Can Objects Have Hyperlinks?
-
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
-
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 -
Thanks TIG,
I'll look at that now.
Greg
-
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
-
@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?
-
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 = mtest 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
-
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
-
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)
...
-
Thanks TIG, I'll add this code and evaluate.
Greg
-
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.
Advertisement