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. AMS stands for Anton M Synytsia.

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

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
TEMP_DIR =

Since:

  • 2.0.0

dir.freeze

Class Method Summary collapse

Class Method Details

.clamp(value, min, max) ⇒ Numeric

Clamp value between min and max.

Parameters:

  • value (Numeric)
  • min (Numeric, nil)

    Pass nil to have no min limit.

  • max (Numeric, nil)

    Pass nil to have no max limit.

Returns:

  • (Numeric)

Since:

  • 2.0.0

.get_entity_by_id(id) ⇒ Sketchup::Entity?

Get entity by entity ID.

Parameters:

  • id (Fixnum)

Returns:

  • (Sketchup::Entity, nil)

Since:

  • 2.0.0

.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

.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

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

Determine whether an object is a true or false.

Returns:

  • (Boolean)

Since:

  • 2.0.0

.max(a, b) ⇒ Numeric

Get the greatest of two values.

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 2.0.0

.min(a, b) ⇒ Numeric

Get the least of two values.

Parameters:

  • a (Numeric)
  • b (Numeric)

Returns:

  • (Numeric)

Since:

  • 2.0.0

.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

.sign(value) ⇒ Fixnum

Get sign of a numeric value.

Parameters:

  • value (Numeric)

Returns:

  • (Fixnum)

    -1, 0, or 1

Since:

  • 2.0.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