ProgressBar v.1.000
by Todd Burch
download
free
description Displays a progress bar on the status line while a script is running. Several scripts need this script to run. It may also be used by other script writers.

usage

This Ruby script is required for several scripts. It provides a way for the calling scripts to communicate with you the progress of long running scripts.

There are 3 possible components to the progress bar text that shows up in the Status Bar within SketchUpTM.

  1. The first part is the actual "slider" that shows a visual bar with a moving token.
  2. Second, the progress bar will indicate the "Expected End Time"; when it thinks the script will complete based on current performance rate. This might change slightly as processing continues. The "Expected End Time" is handy when SketchUp and Ruby seem to lock up your display and you don't know when the script might complete.
  3. Finally, the name of the phase that is executing. A script can have more than one progress bar. The text in this section will be whatever the script author chooses to call the phase.

 

When you download this script, place it in your /Plugins folder like you would for most every other script.

Programming with ProgressBar

If you want to use progressbar.rb in your own Ruby scripts, you may, and here is how to do it.

First, you need to require it.

     require 'progressbar.rb'  
 

Then, once you determine the total number of items you will be processing, create a new instance of a ProgressBar, passing both the total count and the optional name of the phase. (This is case sensitive)

 
     pb = ProgressBar.new(total_number{,optional_string})    # coding template
     pb = ProgressBar.new(myArray.length,"Making Faces...")  # coding example 
 

Each time you process an item in your script, you need to update the progress bar, like this:

 
     pb.update(current_item_number)  # coding template 
     pb.update(i)                    # coding example 
 

There are no other methods.

Pretty easy? I hope you make good "progress"!



see also other scripts by Todd Burch:
IntersectOverlaps
CloseOpens
ExtendCloseLines
ExplodeImplode

notice By downloading and installing this script, you indicate that you have read and agree to the terms and conditions of the End-User License Agreement (EULA). Prices subject to change.