Module: AMS

Defined in:
ext-ruby/ams_lib/main.rb,
docs/ams.rb,
ext-ruby/ams_Lib.rb,
ext-ruby/ams_lib/translate.rb,
ext-ruby/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_RUBY_VERSION_25 =

Since:

  • 3.6.0

(RUBY_VERSION =~ /^2.5/ ? true : false)
IS_RUBY_VERSION_27 =

Since:

  • 3.7.0

(RUBY_VERSION =~ /^2.7/ ? 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

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

.clamp_int(value, min, max) ⇒ Integer

Clamp integer value between min and max.

Parameters:

  • value (Integer)
  • min (Integer)
  • max (Integer)

Returns:

  • (Integer)

Since:

  • 3.6.0

.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

.get_entity_by_id(id) ⇒ Sketchup::Entity?

Get entity by entity ID.

Parameters:

  • id (Integer)

Returns:

  • (Sketchup::Entity, nil)

Since:

  • 2.0.0

.get_folder_path(csidl) ⇒ String

Note:

Windows only!

Retrive a properly encoded path

Parameters:

  • csidl (Integer)

    An identifier associated with a folder to be retrived.

Returns:

  • (String)

See Also:

Since:

  • 3.7.0

.get_top_entity_by_id(id) ⇒ Sketchup::Entity?

Get top level entity by entity ID.

Parameters:

  • id (Integer)

Returns:

  • (Sketchup::Entity, nil)

Since:

  • 3.0.0

.inspect_element(item) ⇒ Object

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

Parameters:

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

    An object to convert. An Array and a Hash can only contain objects of NilClass, TrueClass, FalseClass, Integer, 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

.is_boolean?(object) ⇒ Boolean

Determine whether an object is a true or false.

Returns:

  • (Boolean)

Since:

  • 2.0.0

.max(a, b) ⇒ Numeric

Get the maximum of two values

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 2.0.0

.max_int(a, b) ⇒ Integer

Get the greatest of two integer values.

Parameters:

  • a (Integer)
  • b (Integer)

Returns:

  • (Integer)

Since:

  • 3.6.0

.max_real(a, b) ⇒ Numeric

Get the greatest of two floating values.

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 3.6.0

.min(a, b) ⇒ Numeric

Get the minimum of two values

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 2.0.0

.min_int(a, b) ⇒ Integer

Get the least of two integer values.

Parameters:

  • a (Integer)
  • b (Integer)

Returns:

  • (Integer)

Since:

  • 3.6.0

.min_real(a, b) ⇒ Numeric

Get the least of two floating values.

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 3.6.0

.round(number, precision = 0) ⇒ Numeric

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

Parameters:

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

Returns:

  • (Numeric)

Since:

  • 3.3.0

.sign(val) ⇒ Integer

Get sign of a numeric value.

Parameters:

  • val (Numeric)

Returns:

  • (Integer)

    -1, 0, or 1

Since:

  • 2.0.0

.sign_int(value) ⇒ Integer

Get sign of a integer value.

Parameters:

  • value (Integer)

Returns:

  • (Integer)

    -1 or 1

Since:

  • 3.6.0

.sign_real(value) ⇒ Integer

Get sign of a floating value.

Parameters:

  • value (Numeric)

Returns:

  • (Integer)

    -1 or 1

Since:

  • 3.6.0

.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

Instance Method Details

#get_temp_dirString

Returns:

  • (String)

Since:

  • 3.7.0

#refresh_toolbarsObject

Since:

  • 3.6.0