SketchUp  Ruby API Reference 

Class Index

Method Index

Developers Guide

Examples

Numeric class

Parent: Object

Methods: cm, degrees, feet, inch, km, m, mile, mm, radians, to_cm, to_feet, to_inch, to_km, to_l, to_m, to_mile, to_mm, to_yard, yard

Example Code: numerictests.rb

Instance Methods


cm

The cm method is used to convert from centimeters to inches.

Syntax

inches = value.cm 

Return Value

inches - a value in inches if successful

Example

cm = 10

inches = cm.cm

 

 


degrees 

The degrees method is used to convert from degrees to radians.

Syntax

radians = angle.degrees 

Return Value

radians - a value in radians if successful

Comments

For example 90.degrees would return 1.5707963267949

Example

degrees = 90

radians = degrees.degrees

 

 


feet 

The feet method is used to convert from feet to inches.

Syntax

inches = value.feet 

Return Value

inches - a value in inches if successful

Example

feet = 1

inches = feet.feet

 

 


inch 

The inch method converts a number to a length.

Syntax

length = value.inch 

Return Value

length - a Length object if successful

Example 

number = 100

length = number.inch

 

 


km 

The km method is used to convert from kilometers to inches.

Syntax

inches = value.km 

Return Value

inches - a value in inches if successful

Example

 km = 1
 inches = km.km

 

 


The m method is used to convert meters to inches.

Syntax

inches = value.m 

Return Value

inches - a value in inches if successful

Example

meters = 1

inches = meters.m

 

 


mile 

The mile method is used to convert from miles to inches.

Syntax

inches = value.mile 

Return Value

inches - a value in inches if successful

Example

miles = 1

inches = miles.mile

 

 


mm 

The mm method is used to convert a number to millimeters.

Syntax

mm = value.mm 

Return Value

mm - a value in millimeters if successful

Comments

It returns a Length value which is the same length as the given value. For example

len = 25.4.mm returns 1 inch.

Example 

mm = 10

length = mm.mm

 

 


radians 

The radians method is used to convert from radians to degrees.

Syntax

degrees = value.radians 

Return Value

degrees - a value in degrees if successful

Comments

For example, 1.5707963267949.radians would return 90.0

Example

radians = 1.5707963267949

degrees = radians.radians

 

 


to_cm

The to_cm method is used to convert from inches to centimeters.

Syntax

cm = length.to_cm 

Return Value

cm - a value in centimeters if successful

Example

inches = 1

cm = inches.to_cm

 

 


to_feet 

The to_feet method is used to convert from inches to feet.

Syntax

feet = length.to_feet 

Return Value

feet - a value in feet if successful

Example

inches = 12
feet = inches.to_feet

 

 


to_inch 

The to_inch method converts from inches to inches.

Syntax

inches = length.to_inch 

Return Value

inches - a value in inches if successful

Comments

This does not change the value.

Example

inches = 12
inches = inches.to_inch

 

 


to_km 

The to_km method is used to convert from inches to kilometers.

Syntax

kilometers = length.to_km 

Return Value

kilometers - a value in kilometers if successful

Example

inches = 1
km = inches.to_km

 

 


to_l 

The to_l is used to convert from a number to a length.

Syntax

length = value.to_l 

Return Value

length - a Length object if successful

Example

number = 12
length = number.to_l

 

 


to_m 

The to_m method is used to convert from inches to meters.

Syntax

meters = length.to_m 

Return Value

meters - a value in meters if successful

Example

inches = 12
meters = inches.to_m

 

 


to_mile 

The to_mile method is used to convert from inches to miles.

Syntax

miles = length.to_mile 

Return Value

miles - a value in miles if successful

Example

inches = 10000
miles = inches.to_mile

 

 


to_mm 

The to_mm method is used to convert from inches to millimeters.

Syntax

millimeters = length.to_mm 

Return Value

millimeters - a value in millimeters if successful

Example

inches = 1
mm = inches.to_mm

 

 


to_yard 

The to_yard method is used to convert from inches to yards.

Syntax

yards = length.to_yard 

Return Value

yards - a value in yards if successful

Example

inches = 10000
yards = inches.to_y

 

 


yard 

The yard method is used to convert from yards to inches.

Syntax

inches = value.yard 

Return Value

inches - a value in inches if successful

Example

yards = 1
inches = yards.yard