sketchucation logo sketchucation
    • Login
    1. Home
    2. RickW
    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!
    ⚠️ Important | Libfredo 15.8b introduces important bugfixes for Fredo's Extensions Update
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 36
    • Posts 779
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Ruby Challenge!

      Okay, round 2 is closed. TIG and I each got it down to 84 characters with the following code:

      @tig said:

      c=0;Dir["C:/WINDOWS/Media/*v"].each{|w|UI.play_sound w;UI.inputbox([w],["#{c+=1}"])}

      @rickw said:

      i=0;Dir["C:/WINDOWS/Media/*v"].each{|f|UI.play_sound f;puts"#{i+=1}: #{f}";sleep(3)}

      I could have squeezed it to 83 by removing the space after the : in the puts statement, but decided against it.

      Thanks to everyone who worked on this - it was a fun challenge, and we should do another one next month πŸ˜„

      posted in Developers' Forum
      R
      RickW
    • RE: Ruby Challenge!

      That's what I got...

      posted in Developers' Forum
      R
      RickW
    • RE: Ruby Challenge!

      Good effort, but you didn't use the UI.play_sound(filename) method. πŸ˜†

      I'm also a bit worried if you put your system sounds into iTunes πŸ˜‰

      posted in Developers' Forum
      R
      RickW
    • RE: Ruby Challenge!

      Okay, here are the results, sorted by order of submission, path-coded for Windows XP:

      @rickw said:

      147 characters, 5 semicolons

      (f=Dir["C;/Windows/Media/*.wav"]).sort!;i=0;t=UI.start_timer(3,true){puts "#{i}; #{f[i]}";UI.play_sound(f[i]);i+=1;UI.stop_timer(t) if i>=f.length}
      

      @unknownuser said:

      110 characters, 5 semicolons

      fn=0;d="c;/Windows/Media";Dir.foreach(d){|s| fn+=1;UI.play_sound(File.join(d,s));puts "#{fn}; #{s}";sleep(2)}
      

      @tig said:

      114 characters, 2 semicolons

      Dir.chdir(d="C;/WINDOWS/Media/");(c=Dir['*.wav']).each{|w|UI.play_sound(d+w);UI.inputbox([w],[c.index(w).to_s],d)}
      > 
      

      @jim said:

      258 characters, 18 semicolons

      @f=Dir["c;/windows/media/*"];def b(i);io=open(i,"rb");io.pos=28;b=io.read(4);io.close;b.unpack("i")[0].to_f;end;def j;t=0;@f.each_with_index{|s,i|;UI.start_timer(t){;Sketchup.set_status_text"#{i+1};#{s}";UI.play_sound(s);};t+=(File.stat(s).size/b(s));};end;j
      > 
      

      Kudos to Thicket for the shortest code!
      Honorable mention to TIG for second-shortest by 4 characters.
      Kudos to Jim for checking the filesize to get the delay time!
      Kudos to TIG for a really clever way of presenting the track info and avoiding both sound overlaps and system sound intrusion!

      Now, for the follow-up challenge:
      Create the jukebox with less than 100 characters! Entries due by noon (GMT-6) on Monday, 6 August 2007. Short challenge, but the hard work's been done πŸ˜„

      posted in Developers' Forum
      R
      RickW
    • RE: Ruby Challenge!

      So far, we have three entries, all with distinct solutions. Only 3 days left to enter...

      posted in Developers' Forum
      R
      RickW
    • RE: Ruby Challenge!

      Yes, it's definitely a challenge...

      posted in Developers' Forum
      R
      RickW
    • RE: Ruby Challenge!

      I don't see that as a requirement, but if you want to implement it, you may get extra kudos.

      The song number and title may be indicated anywhere you like, but if you use popup boxes, remember they often 'ding' when they appear, and that sound must not interfere with the track being played.

      posted in Developers' Forum
      R
      RickW
    • Ruby Challenge!

      It's been a long time since there was a ruby challenge, so I thought I'd offer one.

      Kudos to the authors who can create a single-line "jukebox" that uses UI.play_sound(filename) to play all the sounds in the system sounds folder in sequence, with an indication of the file number and name. Each sound must be distinctly heard in its entirety without interruption from other system sounds or alerts. There is no penalty for using semicolons.

      The author who submits the shortest code will get extra kudos. πŸ˜„

      PM your solutions to me by noon GMT-6 Friday, 3 August 2007 for consideration.

      The length of the directory path will not be considered when checking the code length.

      posted in Developers' Forum
      R
      RickW
    • RE: Animation Presention Bundle 2

      That is strange. Did you previously have the free version of FlightPath? If so, make sure you overwrite it with the new one from the PresentationBundle2.zip download.

      After you make sure you have the correct version, restart Sketchup. Then open the ruby console, then try FlightPath again as before. If you still don't have the four submenus under "FlightPath", let me know. If any error messages appear in the console, copy them into a message (use the contact form) and I'll take a look.

      PageSmoother uses existing scenes (formerly "pages"), and simply adjusts the transition time between them based on the distance between the camera locations and the travel speed provided by the user in the input box. So, if you had 3 existing scenes and entered 2 meters/second, the plugin will calculate the distance between each scene and set the transition time to the value necessary to cause the motion between scenes to be 2 meters/second. The known issue is if the scene cameras are very close together but have a broad radial motion, the transition time will likely be too short. I'm trying to get a fix for this.

      posted in Developers' Forum
      R
      RickW
    • RE: Key sequence in ruby

      In a tool, when you define onKeyDown, it has a bunch of parameters:
      def onKeyDown(key, repeat, flags, view)

      The "flags" parameter will be a numerical value representing various events or combinations of events. The values are bit-coded and can be added for combined events:
      1 - Left MB
      2 - Right MB
      4 - SHIFT key
      8 - CTRL key
      16 - ???
      32 - ALT key

      So, CTRL+SHIFT+ALT would be a flag value of 44 (8+4+32)

      In your example, then, you want to check if flags==32 and key==38

      posted in Developers' Forum
      R
      RickW
    • RE: How to detect if two faces are EXACTLY coplanar or not?

      @unknownuser said:

      I've got one... hehe

      What's that about?  What do you have?  Can everyone have one?  :smile:
      

      I had to pull out my superhero eyeglasses to read that!

      posted in Developers' Forum
      R
      RickW
    • RE: Animation Presention Bundle 2

      Matt,

      PresentationBundle2 is a collection of four plugins: FlightPath2, PageUtilities2 (2 plugins), and PageExIm.

      FlightPath2 will create pages/scenes based on a selected path of travel. FlightPath (free) is similar, but only has one camera target option, where FP2 has four camera target options (where the camera is looking as it moves along the selected path).

      PageUtilites2 provides a graphical interface for editing scene transition & delay times, and provides a Page Transition Smoother script, which automatically adjusts the transition times for existingpages to create a smooth rate of motion.

      PageExIm allows you to export the scene settings from one model and import them into another model.

      Hope that helps,
      RickW

      posted in Developers' Forum
      R
      RickW
    • RE: FlightPath2 question to RickW

      Edson,

      Yes, FlightPath and FlightPath2 require a path to follow. That path must be a curve - either an arc, circle, polygon, or "welded" curve (a set of edges that have been joined together into a polyline using the weld plugin).

      That path should be at the desired eye level. I usually create the path at ground level, then move it up 5' (~ 1.5m) to a person's eye height. Sometimes I draw a circle and move it very high above a building to do a flyaround from the air.

      Once you have created the path and have it at the desired eye height, select it and right-click to get the FlightPath menu. You will have four options for the target view:

      1. Camera path nodes - the camera will look towards the next vertex/node in the selected path. This is the same behavior as FlightPath (free).
      2. Single Point - as the camera moves along the path, it will look at a single point that you select.
      3. Two Points - as the camera moves along the path, it will look along a line starting at one selected point and transitioning to a second selected point.
      4. Target Path - as the camera moves along the path, it will look at a point that is moving along a second selected path. That path must be created in the same way as the camera path.
      posted in Plugins
      R
      RickW
    • RE: Organizer.rb error on sketchupConnector.dll

      I'll send you the troubleshooting file. It will read the scripts, find the dependencies, and provide a list of files that should be relocated.

      posted in Developers' Forum
      R
      RickW
    • RE: Organizer.rb error on sketchupConnector.dll

      That was two separate questions πŸ˜‰

      Generally, required files must be in the Plugins folder, even if the file doing the requiring is "organized". This can be changed in one of two ways:

      1. hardcode a relative path in the "require" line. Ex:
        require "./mysubfolder/filename.rb"

      2. softcode a relative path in the "require" line. Ex:
        path = File.dirname(FILE).split("/").last
        require "./#{path}/filename.rb"

      I thought about including this in the rewriting portion of the plugin, but decided against it because of the abundance of 'require "sketchup.rb"' and similar lines that shouldn't be changed at all. True, those can be filtered out, but I decided against it for now. I may change my mind later πŸ˜„

      I'm almost done reworking the separate Organizer files into a class contained in one file. It also adds a "test" method to verify where required files should be located.

      posted in Developers' Forum
      R
      RickW
    • RE: Organizer.rb error on sketchupConnector.dll

      What file is requiring the .dll? Is it in a subfolder?

      posted in Developers' Forum
      R
      RickW
    • RE: Finding a face's azimuth

      The problem is compounded by angles generally being measured counter-clockwise, while azimuth angles are measured clockwise.

      I think it would come down to determining the quadrant of the vector (by checking X and Y for +/- value), then adding the previous right-angle azimuth vector to the angle_between of it and the specified vector

      if vector.x>0
        if vector.y>0
          az = [0,1,0].angle_between(vector).radians
        else
          az = [1,0,0].angle_between(vector).radians+Math;;PI/2
        end
      else
        if vector.y<0
          az = [0,-1,0].angle_between(vector).radians+Math;;PI
        else
          az = [-1,0,0].angle_between(vector).radians+(3*Math;;PI/2)
      end
      

      The above example doesn't take into account cases where x or y equal zero, so you'll have to add that. It shouldn't be too difficult, though.

      posted in Developers' Forum
      R
      RickW
    • RE: Face width and height in 2d

      It's possible to use vectors to represent axes. The face.normal should be the Z axis, the X axis should be the intersection of a flat (XY) plane with the face plane, and the Y axis can be determined by the cross product of the X and Z axes.

      There's also a quicker way to do this after finding the Z axis (the face.normal):
      axes = face.normal.axes
      xAxis,yAxis,zAxis = axes

      However you do it, once you have the axis vectors, you can then either:

      1. test the X and Y axes against the points of the face to determine which are minimal and maximal, or
      2. use an axes transform to convert the vertex positions of the face to the world XYZ coordinates and then determine the minimal and maximal XY values.
      posted in Developers' Forum
      R
      RickW
    • RE: How to test if user is currently using Photomatch?

      You could create a Tools observer, which should tell you if the Photomatch tool is active. But beware! on Mac, the names reported by the observer are screwed up. You'll have to rely on the tool number for the script to be cross-platform.

      posted in Developers' Forum
      R
      RickW
    • RE: PayPal - SDK for Ruby

      See below...

      posted in Developers' Forum
      R
      RickW
    • 1
    • 2
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 36 / 39