Have you tried to install as a different user?
Posts
-
Google makes me laugh
-
RE: Some questions...
@gaieus said:
Well, I have my own FTP servers where I can upload anything when needed ...
For those without servers, a website can be leased from a professional ISP. I pay $40/year, domain registration included. (Free is also available if you don't mind being a subdomain showing someone else's ads.)
-
RE: Some questions...
Save your model. Delete most of it. Create a layer named PartA, select all and move everything into layer PartA. Save As... PartA.skp. Open full model, delete the PartA geometry and most of the rest. Move 100% of the remaining geometry into a PartB layer. Save As... PartB.skp. Etc. (And do not use "PartA"... Use sensible names.)
When you File Import... you click each import to the Origin. They all snap together sweetly. Each import is a component. You have layers that are easy to turn on and off. Life is good.
Do all your work on parts. Assemble full model only when needed. (Your full models are all throwaways. You can recreate any of them in a minute.)
See http://www.MartinRinehart.com/models/tutorial/tutorial_06.html#3d for a short discussion re the warehouse.
-
Brilliant-Cut Ruby
Couldn't find a decent ruby (the gem) in the warehouse. Found a nice article describing "brilliant cut" in Wiki, and made a brilliant-cut ruby.

.If you're clever with light and shadow and want to improve my work, the model's at http://www.martinrinehart.com/models/ruby.skp .
-
RE: [Plugin] Scale and Rotate Multiple (UPDATED Dec 22, 09)
@chris fullmer said:
I am learning how to use web dialogs
Chris, is it HTML, JavaScript or the linkage between these and Ruby (or all three)? I'm planning a frontal assault on the latter (rewrite Lininger but going much slower) which I could kick up to the front of the line. I've done HTML (http://www.easyHTMLtutorial.com) and am mulling on JS.
Martin
-
RE: When Ruby Can't Execute_Script
Thanks, Rick.
The w3c insists that you put the <script>...</script> above the </body>. Please join in my subversive campaign against the w3c: http://www.MartinRinehart.com/articles/xhtml-strict-not.html
Doing it your way runs correctly in Chrome, Firefox, MSIE, Opera and Safari, however. (I still use <center>.)
-
RE: Win32ole.so procedure/load issue
@khogg said:
Is this the type of things you're doing with MS Access and Java, and if so, could you provide an example?
Client-proprietary work, but I can say a little more. I assume your MDB has stuff you want sketched up. It must be some sort of table(s) listing type of thing, material, size, location, ... A finished Ruby program would be:
Some preliminary stuff, comments, 'require "sketchup.rb"', etc. You put these where you would normally have a report header.
for each record a call to "draw_whatever( size, material, location args from your database)"
footer = Ruby code for "draw_this", "draw_that", etc.
You code "draw_this" and "draw_that" the old-fashioned way. When the Ruby is tested, copy it into the report footer. Write the report body to output calls to the draw routines. Run the report. Look like code?
Add more blank lines (one every five records? more between logical groups?) Add the header, run the report, writing it to "my_program.rb". SketchUp to the Ruby Console, 'load "my_program.rb"' and off you go!
And if the Google Chrome OS catches fire (big Linux fan here!) you aren't facing a technological dead end with a Windows-locked-in system.
-
RE: When Ruby Can't Execute_Script
@jim said:
You should be able to update your HTML elements in the .show method.
That's what I'm using. Here's some code that people can use to experiment with positioning the JS call.
<!-- lsvm.html --> <html> <body> <div align=center> <h3 id="output"> </h3> <button onclick='rubyCalled("refresh")'>Refresh</button> </div> <script src='lsvm.js'> </script> </body> </html> <!-- end of lsvm.html --># lsvm.rb # showing JS to Ruby to JS communications require 'sketchup.rb' mess_num = 0 wd = UI;;WebDialog.new("Layer/Scene Visibility Map", false, "layer_scene_visibility_map", 200, 200, 200, 200, true) wd.add_action_callback("refresh") do | js_wd, ignored_param | mess_num += 1 script = "rubyReturned( '" + ignored_param + ' ' + mess_num.to_s + "' )" puts script js_wd.execute_script( script ) end wd.set_file( 'lsvm.html' ) wd.show() # end of lsvm.rb// lsvm.js function rubyCalled( callback_name, string ) { if ( (typeof string) == 'undefined' ) string = ''; window.location.href = 'skp;' + callback_name + '@' + string; } function rubyReturned( data ) { document.getElementById( 'output' ).innerHTML = data; } rubyCalled( 'refresh' ) // end of lsvm.js -
Malformed webdialogs passed to Ruby
If you call Ruby from the <head> of your webdialog HTML (or a .js file loaded in the <head>), the webdialog object object passed from JS to Ruby is incapable of execute_script(). No error is triggered. The execute_script() method just doesn't run.
-
Missing param == bug splat
If your Ruby callback has a single parameter (as you might think sensible if you don't care about the second parameter) you get a bug splat.
-
When Ruby Can't Execute_Script
My Ruby didn't always talk to my JS via execute_script(). There's a gotcha that I'll describe here in the hopes that the next person bit by this one will find the answer with a quick Google.
If you need to know something about your model to create your webdialog UI, you will call Ruby from your JS. Fine. Ruby will return what you ask for via the execute_script method of the webdialog object it passes Ruby. Almost fine.
The problem occurs if your JS calls Ruby before the webdialog object is fully formed. If that's the case, the call to execute_script() is a NOP. Your Ruby calls your JS method but it is not called. Hmmm. You double-check spelling, puts() the exact script, ... (Guess how I know this?)
How do you get a fully-formed webdialog? Don't call Ruby from the <head> section, including from a separate .js file loaded in the <head> section. Either call Ruby from the last line of a <script> section immediately before </body> (or from a .js loaded there) or use the body's onload method.
-
RE: Win32ole.so procedure/load issue
I have had good results using ACCESS to write Java. No reason to believe that the same doesn't apply with Ruby. Write the .rb with ACCESS (very capable report writing in ACCESS). Then run the .rb. No Windows-dependent issues.
-
RE: Syntax Error at Line 51718725
@unknownuser said:
Try one of these "</script>" after lets say every 5 or 6 thousand lines.
I'm self-employed and darn sure my crab apple boss will fire me if I ever get to 5k lines in a JS file.
-
RE: Multiple Action Callbacks?
@jim said:
One technique I have used is to pass the name of the Ruby callback to the Javascript. In many cases, you can use a single Javascript function to call any number of Ruby callbacks.
Neat trick, and that tells me exactly what I wanted to know. Now where to we go to get the docs to say "add one or more callbacks ..."?
-
Syntax Error at Line 51718725
IE has just told me that I have an error in my JS at line 51718725.
This is not helpful. I have hundreds, not millions, of lines of JS, of course.
Anyone have helpful tips and tricks for debugging?
I test in Opera until going to webdialog. (Opera's error console is crabbier than Firefox.) But sooner or later you get to those errors at line 51718725.
-
RE: Multiple Action Callbacks?
@jim said:
I was not aware of any limitation on the number of callbacks. Out of curiosity, where did you read that?
I had assumed that you needed a switch in "the" action callback for various options. Didn't know that the "get_data" part of 'skp:get_data@'... from Scott's how-to was a variable.
And where does one report that the invaluable link to Scott's article in the doc is simple text, not a link?
-
Multiple Action Callbacks?
The docs don't say you can do this, but in my first test, it worked. Anybody using this in production code?
# selectionInfo.rb require 'sketchup.rb' # Create the WebDialog instance wd = UI;;WebDialog.new("Selection Info", false, "Selection Info", 200, 200, 200, 200, true) # Attach an action callback wd.add_action_callback("refresh") do | js_wd, ignored_param | total_selected = Sketchup.active_model.selection.length script = "rubyReturned("+ total_selected.to_s + ")" js_wd.execute_script( script ) end wd.add_action_callback("lie") do | js_wd, ignored_param | js_wd.execute_script( "rubyReturned( 'A million' )" ) end # Find and show our html file wd.set_file( 'c;/models/rubies/selectionInfo.html' ) wd.show()You'll need to change that hard-wired path to your own.
<!-- selectionInfo.html --> <html> <head> <script> function rubyCalled( nop ) { query = 'skp;refresh@' + nop; window.location.href = query; } function rubyLies( nop ) { query = 'skp;lie@' + nop; window.location.href = query } function rubyReturned( value ) { var message = value + " items selected."; document.getElementById('output').innerHTML = message; } </script> </head> <body onload='rubyCalled("refresh")'> <div align=center> <h3 id="output"> </h3> <button onclick="rubyCalled('this_is_ignored')">Refresh</button> <button onclick="rubyLies('this_too_is_ignored')">Tell Lie</button> </div> </body> </html>(Thank you, Scott Lininger, for the original code.)
-
RE: Dialog with Webdialog
@rickw said:
If you give all your form fields an ID, you can reference them in ruby without relying on the info passed in the callback. In fact, there are times I don't pass any data in the callback itself, instead using
dialog.get_element_value("myfield")to access the information I need. I only pass the info through the callback if the info is limited to one data set, and then only occasionally.
Excellent tip. Thanks.
-
RE: Dialog with Webdialog
@chrisglasier said:
Don't you think as baby-boomers ...
ChrisAs baby boomers? Are you jumping to conclusions?
I'd say more, but I've got to go turn Greetings from Asbury Park over. The A side just finished.
-
RE: [Request]Define Segment Length Plugin
According to:
the radius "r" of a regular polygon of segment length "s" and number of sides "n" is
r = s / ( 2 * sin(pi/n) )
so the segment length, as a function of the radius should be
s = r * ( 2 * sin(pi/n) )
So file this little bit somewhere (not your plugins directory) as "radius.rb" and when you want it, in your Ruby Console "load /my/choice/radius.rb". (If you're going to use it often, "r = '/my/choice/radius.rb'" and then "load r".)
# radius.rb require 'sketchup.rb' ns = UI.inputbox ['Number of sides; ', 'Side length; '], ['6', '1'],'Radius Given Side Length' n = ns[0].to_f s = ns[1].to_f puts s / ( 2 * Math.sin(Math;;PI / n) )I've not used the VCB part of the API yet. Maybe someone who has can pitch in the last step.