sketchucation logo sketchucation
    • Login
    1. Home
    2. Fancey
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    F
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 7
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Stopping script execution

      I did think it was a bit complicated myself. Most of my programming experience was years ago on 3rd GL stuff. All this is new, but I do have fairly good programming sense.I did try the CSV modifier, but I wasn't using it correctly. That's when I stumbled on JSON. It's only a one shot deal for me, but I have to admit, I do like Ruby! Will be studying your example.
      Thanks again.

      Everett

      posted in Developers' Forum
      F
      Fancey
    • RE: Stopping script execution

      Hi John,

      Got it working. Thanks for pointing me in the right direction. Had to do a bit of learning along the way. I used the CSV and JSON classes. My main script read the original data, processed it into 3d points, and produced an array of lines. After I got all the lines working, I added a block to write the array to file. The second script reads this file, draws a single line, removes it from the array, and writes the array back to file. Here's the pseudo code for the second script:

      access the entities container

      |
      |

      load required classes

      [pre:2k0pic0s]require "CSV"
      require "JSON"[/pre:2k0pic0s]

      take a working copy of the file

      check each time through

      unless File.exist? <filename>
      [pre:2k0pic0s]#take a copy[/pre:2k0pic0s]
      end

      load the lines into an array

      [pre:2k0pic0s]line_arr = CSV.read(<filename>)[/pre:2k0pic0s]

      convert points from string to array of floats

      this caused the most grief until I got it right

      [pre:2k0pic0s]line_arr.map! {|line| line.map {|pt| JSON.parse(pt)}}[/pre:2k0pic0s]
      #draw a line
      [pre:2k0pic0s]ent.add_edges line_arr[0][/pre:2k0pic0s]
      #dump the line
      [pre:2k0pic0s]line_arr.shift[/pre:2k0pic0s]
      #replace the array in the file after checking for last line
      if <last line>
      [pre:2k0pic0s]File.delete(<filename>)[/pre:2k0pic0s]
      else
      [pre:2k0pic0s]CSV.open(<filename>,"wb") do |csv|
      [pre]line_arr.each{|x| csv<< x}[/pre:2k0pic0s]
      end[/pre]
      end
      #use the up arrow to execute as many times as lines

      posted in Developers' Forum
      F
      Fancey
    • RE: Stopping script execution

      Hi John,

       Thanks for the suggestion.  Will see what I can do with it.
      

      Everett

      posted in Developers' Forum
      F
      Fancey
    • Stopping script execution

      I have a number of 3D lines which I can load from a file and draw in the Sketchup window with a script via the ruby console. I would like to be able to step through the lines one at a time. I suspect it's not available because of the working environment. gets, chomp, STDIN does not work.

      Code would look like this:

      Until no_more_lines
      
          ent.add_edges line
          #wait for key board activity at the console
      
       next # line
      

      Any suggestions appreciated

      posted in Developers' Forum
      F
      Fancey
    • RE: Measuring on a curved line

      Hi Frenchy,

      Thanks. This will do it.  I can create a marker which I can copy along the curve, and the segments between markers are what I'm looking for.
      

      Thanks again. So helpful.

      Fancey

      posted in Newbie Forum
      F
      Fancey
    • RE: Measuring on a curved line

      Hi Gilles,

      I'm using bezier and welded curves.
      

      Fancey

      posted in Newbie Forum
      F
      Fancey
    • Measuring on a curved line

      Hi,

      This is my first post, so I may be in the wrong forum. Sorry in advance if so. I am looking for the analogy to either or both the divide command and tape measure tool applied to a curved line. I need to divide and make measurements along a curved line. I am aware of the length in the entity info, and can make some use of it. Also, I tried the poly line segmenters, but the integrity of the curve changes. Maybe I don't understand the results. Any help to point me in the right direction will be much appreciated.

      Thanks

      posted in Newbie Forum sketchup
      F
      Fancey
    • 1 / 1