Thanks Rick and Jim that helped!
Latest posts made by Dhruv
-
RE: Changing scenes from Ruby
Here is the corrected part of javascript. But still I am facing the same problem. Actually that was a typo in my previous post.
<input type="button" onclick="callRuby('selected_page') value ="Scene1">Β
<input type="button" onclick="callRuby('pages1.selected_page') value = "Scene2">Β
<input type="button" onclick="callRuby('pages2.selected_page')" value="Scene 3"> -
Changing scenes from Ruby
**What I am trying to do,
I am trying to change scenes through web-dialogue, Inside web dialogue I have buttons upon which clicken on , scenes will change.
Here is part of my ruby code.**
@@xzybit_dlg.add_action_callback("get_data") do |web_dialog,action_name|
if action_name=="selected_page"
#For scene 1
pages = Sketchup.active_model.pages
pages.selected_page = pages["Scene 1"]
#js_command = "passFromRubyToJavascript("+ selected_page.to_s + ")"
web_dialog.execute_script(js_command)
end# For scene 2 if action_name="selected_page" pages1 = Sketchup.active_model.pages pages1.selected_page = pages1["Scene 2"] #js_command = "passFromRubyToJavascript("+ selected_page.to_s + ")" web_dialog.execute_script(js_command) end # For scene 3 , bug for now, it goes to scene 2 when clicked upon scene 3 if action_name="selected_page" pages2 = Sketchup.active_model.pages pages2.selected_page = pages2["Scene 3"] #js_command = "passFromRubyToJavascript("+ selected_page.to_s + ")" web_dialog.execute_script(js_command) end end
Here is part of my javascript code
function callRuby(actionName) {
query = 'skp:get_data@' + actionName;
window.location.href = query;
}
<input type="button" onclick="callRuby('selected_page')">Β
<input type="button" onclick="callRuby('pages1.selected_page')">Β
<input type="button" onclick="callRuby('pages2.selected_page')" value="Scene 3">scene 1 and 2 are working fine. But when I click on Scene 3 it goes to scene 2 and not scene 3, which needs to be fixed.
Thank you,
Dhruv -
RE: User defined DC functions
I am trying to open a hyperlink basically, when user clicks I want it to direct to web-browser.
-
RE: User defined DC functions
Can you show me how do I use imageURL with onClick function?
Thanks a lot!
Dhruv -
RE: User defined DC functions
Hey Remus,
Can you show me a example? That would be really helpful!
-
RE: User defined functions
or can I have something like this, when I leftclick on any object, it opens a webdialog?