Phlatboyz PhlatScripT
SketchUcam Version 1.1
31/08/2013

HOWTO change the default settings in Constants.rb

The Phlatscript system has long had a file called Constants.rb which contains a long list of contant values. Some of them are used only by the system and are not user settable while others are designed to be user settings that you set once and forget.

Current development of the system revealed that Constants.rb will be changing often as new features are added, thus presenting the problem of 'merging' the new file with your existing options such as default safe cut area and so on.

A new system had to be designed and the simplest is to have a secondary constants file in which you set your options. This file will never be updated by a SketchUcam system upgrade, and so the developers can happily add features without it impacting the upgrade process.

MyConstants.rb

Windows/Mac/Linux users : finding the Plugins/Phlatboyz folder
  1. Open Sketchup
  2. Open the Ruby console, Window|Ruby Console
  3. Paste this string into the Ruby command line Sketchup.find_support_file('Plugins') and press enter
  4. The path to your Plugins folder will be displayed, Phlatboyz is a subfolder, and the MyConstants-example.rb file is in there.
This new file is named MyConstants.rb and the distribution .RBZ file does not contain one
WHAT!?
Well, if the distribution contained one it would get overwritten by an upgrade. Instead, there is a file
C:\Program Files\Google\Google SketchUp 8\Plugins\Phlatboyz\MyConstants-example.rb (see path note for Sketchup Make) which contains mostly the same defaults as Constants.rb except that some are metric and all the system specific stuff that you don't need to mess with (and shouldn't mess with) has been left out.

How to use this file?

The distributed files assume you have a Phlatprinter that is not a Phlatprinter 3, and thus the option for using an overhead gantry is false. Now, you can try to remember to always set that 'true' in the parameters dialog, or you can set the default, BUT HOW?

Follow these steps:

  1. Close Sketchup
  2. Navigate to C:\Program Files\Google\Google SketchUp 8\Plugins\Phlatboyz
  3. RIGHT-click Drag & drop 'MyConstants-example.rb' in that same folder and select 'Copy' from the menu that pops up. It will be named something like 'MyConstants-example - Copy.rb'
  4. Select the file
  5. Press 'F2' to enter rename mode
  6. rename it to MyConstants.rb
Yay, you have a file you can personalize, lets do that....
  1. Click Start|All Programs|Accessories|Notepad
  2. now drag and drop MyConstants.rb onto Notepad
  3. Find Default_overhead_gantry and change 'false' to 'true'. (The example file will sometimes have this set true, and sometimes not).
    So now it looks like
    Default_overhead_gantry = true
  4. Note that because you are editing a computer language file the format has to be followed EXACTLY since the computer is dumb and cannot 'interpret' language it was not designed for. So, take special care to keep spaces and symbols etc in keeping with what is already there.
    Sketchup will fail to load the SketchUcam toolbar if you get anything wrong in this file.

Now let us test Sketchup

  1. Open Sketchup
  2. Click the icon for the Parameters Dialog in the SketchUcam toolbar.
  3. You should see that the checkbox for 'Overhead Gantry' is ticked. Success!
  4. If it is not checked, or the toolbar does not load, you need to check the syntax of whatever you changed in MyConstants.rb and fix it.
    If all your efforts fail, just rename the file to anything but the current name and it will be ignored. Now make a new copy of the example file and try again.

Number formats

Number formats in the contants file are particularly tricky, so let us look at those:

An Inch number constant
10.5.inch
Note the '.' between the last numeral and the 'inch'. This is not optional.
A millimeter constant
12.7.mm
Note the '.' between the last numeral and the 'mm'. This is not optional.
'Just a number'
1.25
This will usually be interpreted as a value in inches since the default for measurements in Sketchup is inches. In fact all internal measurements are in inches, but the models default units may change, which is why we have to be careful to specify the units using .inch or .mm to tell Sketchup exactly what we mean.

what can I change in MyConsants.rb?

Here is the complete MyConstants.rb example file, the constants are named in such a way as to be self explanatory.
Hopefully, they are!
Lines beginning with '#' are comments and will be ignored by the Sketchup system.
require 'sketchup.rb'

# Name Begins With Variable Scope
# $  A global variable
# @  An instance variable
# [a-z] or _  A local variable
# [A-Z]  A constant
# @@ A class variable

module PhlatScript

# - - - - - - - - - - - - - - - - -
#           Default Values
# - - - - - - - - - - - - - - - - -
Default_file_name = "gcode_out.nc"
Default_file_ext = ".nc"
Default_directory_name = Dir.pwd + "/"

Default_spindle_speed = 15000
Default_feed_rate = 2000.0.mm
Default_plunge_rate = 1500.mm
Default_safe_travel = 3.mm
Default_material_thickness = 4.mm
Default_cut_depth_factor = 110
Default_bit_diameter = 3.2.mm
Default_tab_width = 8.mm
Default_tab_depth_factor = 50
Default_vtabs = false
Default_fold_depth_factor = 50

Default_safe_origin_x = 0.0.inch
Default_safe_origin_y = 0.0.inch
Default_safe_width = 1300.mm
Default_safe_height = 2500.mm
Default_comment_remark = "Davids defaults"

Default_overhead_gantry = true
Default_multipass = false
Default_multipass_depth = 2.mm
Default_gen3d = false
Default_stepover = 30

# -------------------------
# PhlatScript Features - things you can set here and not in the parameters dialog
# -------------------------

# Set this to true if you have problems with the parameter dialog being blank or crashing SU
# on Mac, you will probably need this true
# on Linux, you might need this, if you do, you can fix Wine by searching the web for the howto on fixing Sketchup WebDialogs
Use_compatible_dialogs = false

# Set this to true to enable multipass fields in the parameters dialog. When it is false
# you will not be prompted to use multipass. When true you will be able to turn it off and
# on in the parameters dialog
Use_multipass = true

# Set this to true if you have an older version of Mach that does not slow down
# to the Z maximum speed during helical linear interpolation (G2/3 with Z
# movement A.K.A vtabs on an arc). vtabs on arcs will cut at the plunge rate
# defined in this file or overriden in the parameters dialog
Use_vtab_speed_limit = false

# Set this to true to use G61. This will make the machine come to a complete
# stop when changing directions instead of rounding out square corners. When
# set to false the default for your CNC software will be used. Without G61
# the machine might be in G64 mode, this will maintain the best possible speed 
# for the cut even if the tool isn't true to the cut path. 
# Rounded corners at low feedrates aren't very noticeable but anything over 
# 200"/min starts to generate large radii so that the momentum of the machine can be maintained.
Use_exact_path = true

# Set this to true, if you want the safe area to always show, when parameters are saved.
# Otherwise the safe area will only show, if it's size has been changed.
Always_show_safearea = true

# Set this to true to use 1/3 of the usual safe travel height during plunge boring moves
# this saves a lot of air cutting time
Use_reduced_safe_height = true

# Set this true and set the height and the Z will retract to this at the end of the job
# really only useful for overhead gantries
Use_Home_Height = false
Default_Home_Height = 100.mm

# Set this true to generate pocket outlines that cut in CW instead of usual CCW direction
# Please research 'climb milling' before changing this.
# Note this is a draw time option, if you change it in the Gcode you have to redraw all pocket cuts.
Use_pocket_CW = false

# Set this true to generate plunge cuts in CW instead of usual CCW cut direction
# Please research 'climb milling' before changing this.
Use_plunge_CW = false

# Outfeed: phlatprinters only!
# Set this to true to enable outfeed.  At the end of the job it will feed the material out the front of the
# machine instead of stopping at X0 with the material out the back.
# It will feed to 75% of the material size as given by the safe area settings
Use_outfeed = false

#Set this to true to have pocket zigzags default to along Y axis, false for along X axis
#setting can be changed on the fly with the END key
Default_pocket_direction = false


end # module PhlatScript

What not to touch, ever...

The following lines must stay as they are, where they are, otherwise the file will fail to load, preventing the toolbar from showing, and in fact preventing SketchUcam from operating at all.

require 'sketchup.rb'

module PhlatScript
	# some contants may be here
end # module PhlatScript

Path Note

The paths quoted here assume you have Sketchup 8.
If you have Sketchup Make (the 2013 release) then your path will be
C:\Program Files\SketchUp\SketchUp 2013\Plugins\Phlatboyz
unless you installed it in a custom place. If you can do that, we'll have to assume you can find it again.
If you still cannot find it, follow the instructions in the sidebar.