lib/su_info/Template_Code.rb
# An example showing use of the Length constants
#
An example showing use of the Length constants
An example showing use of the Length constants
def len_1
    cns = Length
    h_units  = Hash.new('Unit Unknown')
    h_format = Hash.new('Format Unknown')
    h_units[cns::Centimeter] = 'cm'
    h_units[cns::Feet]       = 'ft'
    h_units[cns::Inches]     = 'in'
    h_units[cns::Meter]      = 'm'
    h_units[cns::Millimeter] = 'mm'
    h_format[cns::Architectural] = 'Architectural'
    h_format[cns::Decimal]       = 'Decimal'
    h_format[cns::Engineering]   = 'Engineering'
    h_format[cns::Fractional]    = 'Fractional'
    om = Sketchup.active_model.options 
    op = om['UnitsOptions']            
    units =  h_units[  op['LengthUnit']   ]
    format = h_format[ op['LengthFormat'] ]
    puts "Current model units are #{units}"
    puts "Current model format is #{format}"
  end
def len_1 cns = Length h_units = Hash . new ( 'Unit Unknown' ) h_format = Hash . new ( 'Format Unknown' ) h_units [ cns :: Centimeter ] = 'cm' h_units [ cns :: Feet ] = 'ft' h_units [ cns :: Inches ] = 'in' h_units [ cns :: Meter ] = 'm' h_units [ cns :: Millimeter ] = 'mm' h_format [ cns :: Architectural ] = 'Architectural' h_format [ cns :: Decimal ] = 'Decimal' h_format [ cns :: Engineering ] = 'Engineering' h_format [ cns :: Fractional ] = 'Fractional' om = Sketchup . active_model . options op = om [ 'UnitsOptions' ] units = h_units [ op [ 'LengthUnit' ] ] format = h_format [ op [ 'LengthFormat' ] ] puts "Current model units are #{units}" puts "Current model format is #{format}" end
An example showing use of the Length constants
An example showing use of the Length constants
# OptionManager # OptionsProvider