Class: Sketchup::CRSLocation

Inherits:
Object
  • Object
show all

Overview

The CRSLocation class contains information that maps the SketchUp model into a projection coordinate system.

Version:

  • SketchUp 2027.0

Constants for CRS Scale # collapse

Sketchup::CRSLocation::METERS
Sketchup::CRSLocation::FEET
Sketchup::CRSLocation::US_SURVEY_FEET

Instance Method Summary # collapse

Constructor Details

↑ #initialize ⇒ Sketchup::CRSLocation #initialize(crslocation) ⇒ Sketchup::CRSLocation

Creates a CRSLocation object.

Examples:

# No arguments, creates an empty CRSLocation
crs_location1 = Sketchup::CRSLocation.new

# Creates a clone of the CRSLocation
crs_location2 = Sketchup::CRSLocation.new(crs_location1)

Sketchup.active_model.crs_location = crs_location2

Overloads:

Version:

  • SketchUp 2027.0

Instance Method Details

↑ #==(other) ⇒ Boolean

The #== method returns whether two Sketchup::CRSLocation are equal within tolerance.

Parameters:

Returns:

  • (Boolean)

Version:

  • SketchUp 2027.0

↑ #calibration_file_name ⇒ String?

The #calibration_file_name method is used to retrieve the name of the calibration file used in the construction of the CRSLocation.

Returns:

Version:

  • SketchUp 2027.0

↑ #calibration_file_name=(calibration_file_name) ⇒ Object

The #calibration_file_name= method is used to set the name of the calibration file used in the construction of the CRSLocation.

Parameters:

  • calibration_file_name (String, nil)

Version:

  • SketchUp 2027.0

↑ #description ⇒ String?

The #description method is used to retrieve the description of the CRSLocation.

Examples:

Sketchup.active_model.crs_location.description

Returns:

Version:

  • SketchUp 2027.0

↑ #description=(description) ⇒ Object

The #description= method is used to set the description of the CRSLocation.

Examples:

Sketchup.active_model.crs_location.description = "British National Grid"

Parameters:

Version:

  • SketchUp 2027.0

↑ #eastings ⇒ Float

The #eastings method is used to retrieve the eastings of the CRSLocation.

The eastings represents the offset in the “X” direction of this models origin from the origin of the coordinate system

Returns:

  • (Float)

Version:

  • SketchUp 2027.0

↑ #eastings=(eastings) ⇒ Float

The #eastings= method is used to set the eastings of the CRSLocation.

Typically #eastings, #northings and #height need to be set together to properly position the model.

Returns:

  • (Float)

Version:

  • SketchUp 2027.0

↑ #geodetic_datum ⇒ String?

The #geodetic_datum method is used to retrieve the name of the geodetic datum of the CRSLocation.

Returns:

Version:

  • SketchUp 2027.0

↑ #geodetic_datum=(geodetic_datum) ⇒ Object

Note:

If the #name is specific enough this may be unnecessary to set.

The #geodetic_datum= method is used to set the name of the geodetic datum of the CRSLocation.

Parameters:

  • geodetic_datum (String, nil)

Version:

  • SketchUp 2027.0

↑ #height ⇒ Float

Note:

this is equivalent to “Orthogonal Height” from the IFC spec.

The #height method is used to retrieve the height of the CRSLocation.

The height represents the offset in the “Z” direction of this models origin from some base height.

Returns:

  • (Float)

Version:

  • SketchUp 2027.0

↑ #height=(height) ⇒ Float

The #height= method is used to set the height of the CRSLocation.

Typically #eastings, #northings and #height need to be set together to properly position the model.

Returns:

  • (Float)

Version:

  • SketchUp 2027.0

↑ #map_projection ⇒ String?

The #map_projection method is used to retrieve the name of the map projection of the CRSLocation.

Returns:

Version:

  • SketchUp 2027.0

↑ #map_projection=(map_projection) ⇒ Object

Note:

If the #name is specific enough this may be unnecessary to set.

The #map_projection= method is used to set the name of the map projection of the CRSLocation.

Parameters:

  • map_projection (String, nil)

Version:

  • SketchUp 2027.0

↑ #map_unit ⇒ Sketchup::CRSMapUnit?

Note:

If there is no map unit defined, meters can be assumed.

The #map_unit method is used to retrieve the map unit of the CRSLocation.

Returns:

Version:

  • SketchUp 2027.0

↑ #map_unit=(map_unit) ⇒ Object

The #map_unit= method is used to set the map unit of the CRSLocation.

↑ #map_zone ⇒ String?

The #map_zone method is used to retrieve the name of the map zone of the CRSLocation.

Returns:

Version:

  • SketchUp 2027.0

↑ #map_zone=(map_zone) ⇒ Object

Note:

If the #name is specific enough this may be unnecessary to set.

The #map_zone= method is used to set the name of the map zone of the CRSLocation.

Parameters:

Version:

  • SketchUp 2027.0

↑ #name ⇒ String

The #name method is used to retrieve the name of the CRSLocation.

Returns:

Version:

  • SketchUp 2027.0

↑ #name=(name) ⇒ Object

The #name= method is used to set the name of the CRSLocation.

For the best interoperability with other BIM and GIS software this should follow the IFC standard.

Examples:

Sketchup.active_model.crs_location.name = "EPSG:27700"

Parameters:

Version:

  • SketchUp 2027.0

↑ #northings ⇒ Float

The #northings method is used to retrieve the northings of the CRSLocation.

The northings represents the offset in the “Y” direction of this models origin from the origin of the coordinate system

Returns:

  • (Float)

Version:

  • SketchUp 2027.0

↑ #northings=(northings) ⇒ Float

The #northings= method is used to set the northings of the CRSLocation.

Typically #eastings, #northings and #height need to be set together to properly position the model.

Returns:

  • (Float)

Version:

  • SketchUp 2027.0

↑ #scale ⇒ Float

Note:

The #scale and #map_unit properties are related.

The #scale method is used to retrieve the scale of the CRSLocation.

The scale represents the ratio between the Sketchup modelling units (inches) and the modelling units of the coordinate system.

For example, if the CRS is in meters, the scale would be 1.m

Returns:

  • (Float)

See Also:

Version:

  • SketchUp 2027.0

↑ #scale=(scale) ⇒ Object

Note:

When calling this method also considering calling #map_unit=

The #scale= method is used to set the scale of the CRSLocation.

Examples:

crs_location = model.crs_location
crs_location.scale = Sketchup::CRSLocation::FEET
# Alternatively:
crs_location.scale = 1.to_feet

Parameters:

  • scale

Raises:

  • (ArgumentError) —

    If the scale is less than or equal to 0.

See Also:

Version:

  • SketchUp 2027.0

↑ #tgl_id ⇒ String?

The #tgl_id method is used to retrieve the TGL (Trimble Geodetic Library) ID of the CRSLocation.

This ID encodes all of the information about the CRS in a compact encoded string.

Returns:

See Also:

Version:

  • SketchUp 2027.0

↑ #tgl_id=(tgl_id) ⇒ Object

Note:

This is currently a mandatory field when setting the CRSLocation on the model.

The #tgl_id= method is used to set the TGL (Trimble Geodetic Library) ID of the CRSLocation.

Parameters:

See Also:

Version:

  • SketchUp 2027.0

↑ #to_s ⇒ String

The #to_s method converts a CRSLocation object to a String.

Examples:

crs_location = Sketchup::CRSLocation.new
str = crs_location.to_s

Returns:

Version:

  • SketchUp 2027.0

↑ #vertical_datum ⇒ String?

The #vertical_datum method is used to retrieve the name of the vertical datum of the CRSLocation.

Returns:

Version:

  • SketchUp 2027.0

↑ #vertical_datum=(vertical_datum) ⇒ Object

Note:

If the #name is specific enough this may be unnecessary to set.

The #vertical_datum= method is used to set the name of the vertical datum of the CRSLocation.

Parameters:

  • vertical_datum (String, nil)

Version:

  • SketchUp 2027.0

↑ #x_axis ⇒ Geom::Vector2d

The #x_axis method is used to retrieve the x_axis of the CRSLocation.

The x_axis represents the direction of the local “X” axis in terms of the coordinate system.

The default value is (1, 0), which means that the local orientation matches the coordinate system.

Returns:

Version:

  • SketchUp 2027.0

↑ #x_axis=(x_axis) ⇒ Object

The #x_axis= method is used to set the x_axis of the CRSLocation.

Examples:

Orienting the model so that the local “X” axis points north:

model = Sketchup.active_model
crs_location = model.crs_location
crs_location.x_axis = [0, 1]
model.crs_location = crs_location

Parameters:

Version:

  • SketchUp 2027.0