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 plugin is required for several other plugins. It provides a way for the calling plugin to communicate with you the progress of long running functions.

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 plugin 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 plugin might complete.
  3. Finally, the name of the phase that is executing. A plugin can have more than one progress bar. The text in this section will be whatever the plugin author chooses to call the phase.

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



Programming with ProgressBar

If you want to use progressbar.rb in your own Ruby plugins, 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 plugin, 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 plugins by Todd Burch:
CloseOpens
IntersectOverlaps
ExtendCloseLines
ExplodeImplode

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