Module: AMS

Defined in:
RubyExtension/ams_Lib/main.rb,
Documentation/ams.rb,
RubyExtension/ams_Lib.rb,
RubyExtension/ams_Lib/translate.rb,
RubyExtension/ams_Lib/extension_manager.rb

Overview

AMS is a top level namespace of AMS Library.

Since:

  • 1.0.0

Defined Under Namespace

Modules: Cursor, DLL, Geometry, Group, Keyboard, Lib, MIDI, Menu, Registry, Screen, Sketchup, System, Timer, Window Classes: ExtensionManager, MultiLineText, SketchupObserver, Translate

Constant Summary collapse

IS_PLATFORM_WINDOWS =

Since:

  • 2.0.0

(RUBY_PLATFORM =~ /mswin|mingw/i ? true : false)
IS_PLATFORM_OSX =

Since:

  • 2.0.0

(RUBY_PLATFORM =~ /darwin/i ? true : false)
IS_PLATFORM_LINUX =

Since:

  • 2.0.0

(RUBY_PLATFORM =~ /linux/i ? true : false)
IS_RUBY_VERSION_18 =

Since:

  • 3.5.0

(RUBY_VERSION =~ /^1.8/ ? true : false)
IS_RUBY_VERSION_20 =

Since:

  • 3.5.0

(RUBY_VERSION =~ /^2.0/ ? true : false)
IS_RUBY_VERSION_22 =

Since:

  • 3.5.0

(RUBY_VERSION =~ /^2.2/ ? true : false)
IS_SKETCHUP_64BIT =

Since:

  • 3.5.0

((::Sketchup.respond_to?('is_64bit?') && ::Sketchup.is_64bit?) ? true : false)
IS_SKETCHUP_32BIT =

Since:

  • 3.5.0

!IS_SKETCHUP_64BIT
SU_MAJOR_VERSION =

Since:

  • 3.6.0

::Sketchup.version.to_i
TEMP_DIR =

Since:

  • 2.0.0

dir.freeze
SU_PLUGINS_LOCATION =

Since:

  • 3.6.0

dir.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.clamp(val, min_val, max_val) ⇒ Numeric

Clamp value between minimum and maximum limits.

Parameters:

  • val (Numeric)
  • min_val (Numeric, nil)

    Pass nil to have no min limit.

  • max_val (Numeric, nil)

    Pass nil to have no max limit.

Returns:

  • (Numeric)

Since:

  • 2.0.0


67
68
69
70
71
72
73
74
75
# File 'RubyExtension/ams_Lib/main.rb', line 67

def clamp(val, min_val, max_val)
  if (min_val && val < min_val)
    min_val
  elsif (max_val && val > max_val)
    max_val
  else
    val
  end
end

.clamp_int(value, min, max) ⇒ Fixnum

Clamp integer value between min and max.

Parameters:

  • value (Fixnum)
  • min (Fixnum)
  • max (Fixnum)

Returns:

  • (Fixnum)

Since:

  • 3.6.0


65
66
# File 'Documentation/ams.rb', line 65

def clamp_int(value, min, max)
end

.clamp_real(value, min, max) ⇒ Numeric

Clamp floating value between min and max.

Parameters:

  • value (Numeric)
  • min (Numeric)
  • max (Numeric)

Returns:

  • (Numeric)

Since:

  • 3.6.0


33
34
# File 'Documentation/ams.rb', line 33

def clamp_real(value, min, max)
end

.get_entity_by_id(id) ⇒ Sketchup::Entity?

Get entity by entity ID.

Parameters:

  • id (Fixnum)

Returns:

  • (Sketchup::Entity, nil)

Since:

  • 2.0.0


111
112
# File 'Documentation/ams.rb', line 111

def get_entity_by_id(id)
end

.get_top_entity_by_id(id) ⇒ Sketchup::Entity?

Get top level entity by entity ID.

Parameters:

  • id (Fixnum)

Returns:

  • (Sketchup::Entity, nil)

Since:

  • 3.0.0


118
119
# File 'Documentation/ams.rb', line 118

def get_top_entity_by_id(id)
end

.inspect_element(item) ⇒ Object

Convert a Ruby object to string that can be evaluated back into the same object.

Parameters:

  • item (nil, Boolean, Fixnum, Bignum, Float, String, Symbol, Array, Hash)

    An object to convert. An Array and a Hash can only contain objects of NilClass, TrueClass, FalseClass, +Fixnum, Float, Bignum, String, Symbol, Array, and Hash types. This, as well, applies to sub-arrays and sub-hashes.

Raises:

  • (TypeError)

    if given item or sub-item type is not supported.

Since:

  • 3.1.0


13
14
# File 'Documentation/ams.rb', line 13

def inspect_element(item)
end

.is_boolean?(object) ⇒ Boolean Also known as: is_bool?

Determine whether an object is a true or false.

Returns:

  • (Boolean)

Since:

  • 2.0.0


102
103
# File 'Documentation/ams.rb', line 102

def is_boolean?(object)
end

.max(a, b) ⇒ Numeric

Get the maximum of two values

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 2.0.0


91
92
93
# File 'RubyExtension/ams_Lib/main.rb', line 91

def max(a, b)
  (a > b) ? a : b
end

.max_int(a, b) ⇒ Fixnum

Get the greatest of two integer values.

Parameters:

  • a (Fixnum)
  • b (Fixnum)

Returns:

  • (Fixnum)

Since:

  • 3.6.0


88
89
# File 'Documentation/ams.rb', line 88

def max_int(a, b)
end

.max_real(a, b) ⇒ Numeric

Get the greatest of two floating values.

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 3.6.0


56
57
# File 'Documentation/ams.rb', line 56

def max_real(a, b)
end

.min(a, b) ⇒ Numeric

Get the minimum of two values

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 2.0.0


82
83
84
# File 'RubyExtension/ams_Lib/main.rb', line 82

def min(a, b)
  (a < b) ? a : b
end

.min_int(a, b) ⇒ Fixnum

Get the least of two integer values.

Parameters:

  • a (Fixnum)
  • b (Fixnum)

Returns:

  • (Fixnum)

Since:

  • 3.6.0


80
81
# File 'Documentation/ams.rb', line 80

def min_int(a, b)
end

.min_real(a, b) ⇒ Numeric

Get the least of two floating values.

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 3.6.0


48
49
# File 'Documentation/ams.rb', line 48

def min_real(a, b)
end

.round(number, precision = 0) ⇒ Numeric

Round a numeric value to a particular number of decimal places.

Parameters:

  • number (Numeric)
  • precision (Fixnum) (defaults to: 0)

Returns:

  • (Numeric)

Since:

  • 3.3.0


96
97
# File 'Documentation/ams.rb', line 96

def round(number, precision = 0)
end

.sign(val) ⇒ Fixnum

Get sign of a numeric value.

Parameters:

  • val (Numeric)

Returns:

  • (Fixnum)

    -1, 0, or 1

Since:

  • 2.0.0


99
100
101
102
103
104
105
106
107
# File 'RubyExtension/ams_Lib/main.rb', line 99

def sign(val)
  if val > 0
    return 1
  elsif val < 0
    return -1
  else
    return 0
  end
end

.sign_int(value) ⇒ Fixnum

Get sign of a integer value.

Parameters:

  • value (Fixnum)

Returns:

  • (Fixnum)

    -1 or 1

Since:

  • 3.6.0


72
73
# File 'Documentation/ams.rb', line 72

def sign_int(value)
end

.sign_real(value) ⇒ Fixnum

Get sign of a floating value.

Parameters:

  • value (Numeric)

Returns:

  • (Fixnum)

    -1 or 1

Since:

  • 3.6.0


40
41
# File 'Documentation/ams.rb', line 40

def sign_real(value)
end

.validate_type(object, *types) ⇒ void

This method returns an undefined value.

Validate object type.

Parameters:

  • object (Object)
  • types (Class, Array<Class>)

    A class or an array of classes to check against.

Raises:

  • (TypeError)

    if object class doesn't match with any of the specified types.

Since:

  • 2.0.0


24
25
# File 'Documentation/ams.rb', line 24

def validate_type(object, *types)
end

Instance Method Details

#refresh_toolbarsObject

Since:

  • 3.6.0


112
113
# File 'RubyExtension/ams_Lib/main.rb', line 112

def refresh_toolbars
end