@chris fullmer said:
Laughing at my inability to express myself in functional english there Todd
, or is there a big inside joke I missed (both equally likely).
Chris
The first.
@chris fullmer said:
Laughing at my inability to express myself in functional english there Todd
, or is there a big inside joke I missed (both equally likely).
Chris
The first.
Hi nics.
You can use fractions pretty easily.
entities = Sketchup.active_model.active_entities ;
face = entities.add_face(entities.add_circle(ORIGIN, Y_AXIS, 2.125.inch)).pushpull 4.inch ;
or
face = entities.add_face(entities.add_circle(ORIGIN, Y_AXIS, '2 1/8"'.to_l)).pushpull 4.inch ;
Note that there are many predefined constants for common locations/vectors you can use, and when it's not too cryptic for you, you can string commands together as well. Paste the above 2 lines into the Ruby Console and you'll get the same result.
Todd
The code looks good to me.
My comment about the "outer loop" should have really have been phrased as "once somewhere in the nesting of the loops". Where it was placed is where I would have placed it - in the meat of processing.
If, for an extreme example, two progress bars were made, one for horizontals and another for verticals, it would work, but the status bars would be bouncing between the two, making it overly complicated and confusing to the user.
If the 3 loops are nested, you can just use the outer loop and have one progress bar.
If you have 3 separate loops, you can have a unique instance of a progressbar in each one.
Thanks, Todd
Yes, that would be fine to manage it yourself.
Do you have access to the pickaxe book? Try ScriptError. Try a stepladder of all the exception subclasses with multiple rescues.
From the Pickaxe Book: (Ruby 1.8, page 110)
@unknownuser said:
"If you write a rescue clause with no clause parameter list, the parameter defaults to StandardError"
You got a SyntaxError, which is part of ScriptError, not StandardError.
Try this:
rescue Exception => e
to catch everything.
Unless the files you create on a Mac via this dialog will be moved over to Windows for the purpose of being read with Notepad (and this is only because Notepad is stupid), I personally see no productivity or functionality gains from bothering with each platforms newline patterns, unless you just want to.
But heh, that's just me.
Any now my question.
Why are you coding at that level? Why not just bust the input data up into ruby "newlines"?
Works for me on a Mac - no errors shown. You are missing a semi-colon in your javascript.
On Windows, I do get the unterminated string error, but changing your line from this:
crlf = '\x0d\x0a' ;
to this:
crlf = '\\x0d\\x0a' ;
resolves the error. That's the nature of the beast (ruby). You gotta double your backslashes if you want backslashes.
Can you post a failing (small, complete) example?
Like I said, not tested on IE. If the browser does not respond to button.addEventListener, use button.attachEvent.
https://developer.mozilla.org/en/DOM/element.addEventListener
(By the way, I spent > 2 hours on this last night)
Is the alert box that is popping up this one?
alert('hi there');
?
@cjthompson said:
I am trying to create a dynamic web page through javascript. Everything is working except for the "onclick" event for buttons.
...does anyone have any ideas?
Yes. This works on a Mac: (Didn't test on IE)
class WebTest < UI;;WebDialog
def initialize
super("This is a test",true,"Test",250,250,250,250,true) ;
html =<<HTML
<html>
<head>
<script>
function addButton() {
alert('hi there');
var body = document.body;
var button = document.createElement('input');
button.type = 'button';
button.value = 'Click Me';
button.id = 'btn1';
var message = 'I am working';
button.addEventListener("click", function() { alert(message);} , true ) ;
body.appendChild(button);
}
</script>
</head>
<body>
Yo
</body>
</html>
HTML
set_html(html)
end
def add_button
execute_script("addButton();") ;
end ;
end
And, in the Ruby Console:
> load 'myscripts/webtest.rb'
true
> w = WebTest.new
#<WebTest;0x1d545b24>
> w.show
true
> w.add_button
true
You can send out progressbar with your code, but tell your clients where you got it and to come to us for support.
Todd
How can I be of assistance?