sketchucation logo sketchucation
    • Login
    1. Home
    2. todd burch
    3. Posts
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download
    T
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 55
    • Posts 903
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Auto add numbers in Ruby?

      @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.

      posted in Developers' Forum
      T
      todd burch
    • RE: Auto add numbers in Ruby?

      @unknownuser said:

      ...4 10's places....

      HAR HAR HAR HAR HAR!!!!!!!

      posted in Developers' Forum
      T
      todd burch
    • RE: Inche fraction in ruby script

      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

      posted in Developers' Forum
      T
      todd burch
    • RE: Implementing Todds' Progress Bar?

      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.

      posted in Developers' Forum
      T
      todd burch
    • RE: Implementing Todds' Progress Bar?

      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

      posted in Developers' Forum
      T
      todd burch
    • RE: Drawing Joints on Sketchup Objects

      Try this: http://www.smustard.com/script/CenterPoint

      posted in Developers' Forum
      T
      todd burch
    • RE: Mac WebDialog & Flash

      Never tried it.

      posted in Developers' Forum
      T
      todd burch
    • RE: [CExt] malloc vs ALLOC

      Yes, that would be fine to manage it yourself.

      posted in Developers' Forum
      T
      todd burch
    • RE: Untrapped Error

      Do you have access to the pickaxe book? Try ScriptError. Try a stepladder of all the exception subclasses with multiple rescues.

      posted in Developers' Forum
      T
      todd burch
    • RE: Untrapped Error

      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.

      posted in Developers' Forum
      T
      todd burch
    • RE: Textarea line separators on Mac

      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. πŸ˜†

      posted in Developers' Forum
      T
      todd burch
    • RE: Textarea line separators on Mac

      Any now my question.

      Why are you coding at that level? Why not just bust the input data up into ruby "newlines"?

      posted in Developers' Forum
      T
      todd burch
    • RE: Textarea line separators on Mac

      You're welcome!

      Todd


      SketchUp001.jpg

      posted in Developers' Forum
      T
      todd burch
    • RE: WebDialog.set_html() Gotchas

      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.

      posted in Developers' Forum
      T
      todd burch
    • RE: WebDialog.set_html() Gotchas

      Can you post a failing (small, complete) example?

      posted in Developers' Forum
      T
      todd burch
    • RE: Trouble triggering javascript event from sketchup

      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)

      posted in Developers' Forum
      T
      todd burch
    • RE: Trouble triggering javascript event from sketchup

      Is the alert box that is popping up this one?

      
      alert('hi there'); 
      
      

      ?

      posted in Developers' Forum
      T
      todd burch
    • RE: Trouble triggering javascript event from sketchup

      @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
      
      
      posted in Developers' Forum
      T
      todd burch
    • RE: Re-use progress bar that Dynamic Components use

      You can send out progressbar with your code, but tell your clients where you got it and to come to us for support.

      Todd

      posted in Developers' Forum
      T
      todd burch
    • RE: Help and contribution needed. Thank you.

      How can I be of assistance? πŸ˜‰

      posted in Developers' Forum
      T
      todd burch
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 45
    • 46
    • 5 / 46