Product Documentation
Virtuoso Relative Object Design SKILL Reference
Product Version IC23.1, June 2023

2


Relative Object Design Coordinate Functions

This chapter contains information on the Virtuoso relative object design (ROD) coordinate functions.

For more information on relative object design coordinate objects, refer to the Virtuoso Relative Object Design User Guide.

The functions in this chapter are listed in the alphabetical order.

rodCoordBisect

rodCoordCreate

rodCoordDefineGrid

rodCoordFix

rodCoordGetGrid

rodCoordIsOnGrid

rodCoordParseString

rodCoordPartition

rodCoordSnap

rodCoordToFloat

rodCoordToInt

rodCoordToString

rodCoordBisect

rodCoordBisect(
o_rodCoord [ S_snapType ]
);end rodCoordBisect
=> o_rodCoord

Description

Divides the input value by two (bisect). You can optionally set the argument that rounds off the calculated value, truncates it, or converts it based on the defined maximum ceiling.

Arguments

o_rodCoord

A rodCoord object.

S_snapType

A symbol representing snap type (ROUND, TRUNCATE, CEILING)

ROUND– Converts the value to the nearest arithmetic unit with the mid-point value rounding away from the zero grid point.
TRUNCATE – Converts the value to the next arithmetic unit towards the zero grid point.
CEILING – Converts the value to the next larger arithmetic unit towards positive infinity.

Default value: TRUNCATE.

Value Returned

o_rodCoord

Returns a new rodCoord object. A SKILL error is returned if the input value is invalid.

Example

rodCoordBisect(coord1)
  => rodCoord@0x016036

In this example, a new rodCoord object is returned.

rodCoordCreate

rodCoordCreate(
g_inputValue [ S_unitType [ S_snapType ] ]
[ x_resolution ]
);end rodCoordCreate
=> o_rodCoordObj

Description

Creates a rodCoord object from the given value, that is, g_inputValue.

Arguments

g_inputValue

The input value for the constructor. It could be a float or integer number, or a string representing a float or integer number, or a rodCoord object.

The unitType and snapType arguments are ignored when the input is a rodCoord object.

S_unitType

An optional argument that specifies a symbol representing the unit type of the input value, such as ARITHMETIC_UNIT or USER_UNIT.

Default value: USER_UNIT.

S_snapType

A symbol representing the snap type (ROUND, TRUNCATE, CEILING). This argument is only applicable when the unit type is USER_UNIT.

ROUND – Converts the value to the nearest arithmetic unit with the mid-point value rounding away from the zero grid point.
TRUNCATE – Converts the value to the next arithmetic unit towards the zero grid point.

CEILING – Converts the value to the next larger arithmetic unit towards positive infinity.

Default value: ROUND.

x_resolution

An integer value that defines the number of arithmetic units in one user unit value.

Value Returned

o_rodCoord

Returns a new instance of the rodCoord user type. A SKILL error is returned if the input value is invalid.

Example

rodCoordCreate(1.25 'USER_UNIT 'ROUND)
 => rodCoord@0x018ex64

In this example, a new instance of the rodCoord object is returned.

rodCoordDefineGrid

rodCoordDefineGrid(
n_gridValue  
x_resolutionValue
);end rodCoordDefineGrid
=> t

Description

Defines the grid and the arithmetic resolution factor values, which are used by the rodCoord* API.

Arguments

n_gridValue

A fixed or floating number in the user unit that defines the grid value.

x_resolutionValue

An integer value that defines the number of arithmetic units in one user unit value.

Value Returned

t

The function is executed successfully.

Example

rodCoordDefineGrid(10.2 1000000)
=> t

In this example, the grid and arithmetic resolution factor values are defined.

rodCoordFix

rodCoordFix(
o_rodCoord
);rodCoordFix
=> o_newRodCoord

Description

Fixes the rodCoord object and returns a new rodCoord object using the fix() SKILL function.

Arguments

o_rodCoord

Specifies the rodCoord object.

Value Returned

o_newRodCoord

A new rodCoord object is returned. A SKILL error is returned if the input value is invalid.

Example

rodCoordFix(coord2)
=> rodCoord0x01604206

In this example, the rodCoord object, coord2 is truncated and a new rodCoord object is returned.

rodCoordGetGrid

rodCoordGetGrid()
;end rodCoordGetGrid
=> o_gridValue

Description

Returns the grid value (defined by rodCoordDefineGrid) as a rodCoord object.

Arguments

None.

Value Returned

o_gridValue

A grid value defined by the rodCoordDefineGrid function as a rodCoord object is returned. A SKILL error is returned if the input value is invalid.

Example

rodCoordGetGrid()
=> rodCoord@0x018ef24

In this example, a grid value is returned as a rodCoord object.

rodCoordIsOnGrid

rodCoordIsOnGrid(
o_rodCoord
[ n_gridValue ]
);end rodCoordIsOnGrid
=> t / nil

Description

Checks if the data in the given rodCoord object is on the grid or not.

Arguments

o_rodCoord

Specifies a valid rodCoord object.

n_gridValue

Specifies a fixed or floating number in user units that defines the grid value. If n_gridValue is not specified, the grid value (global) is set using the rodCoordDefineGrid function.

However, if the global grid value is not set and the rodCoordIsOnGrid function is called without the second argument, the SKILL error is returned.

Value Returned

t

The data in the given rodCoord object is on the grid.

nil

The data in the given rodCoord object is not on the grid.

Example

rodCoordIsOnGrid(coord1)
=> t

In this example, the data in the specified rodCoord object is on the grid.

rodCoordParseString

rodCoordParseString(
t_rodStringCoord
)
=> o_rodCoord

Description

Creates a rodCoord object out of t_rodString generated by the rodCoordToString function.

Arguments

t_rodStringCoord

The string representation of the rodCoord object that is generated by the rodCoordToString SKILL function.

Value Returned

o_rodCoord

Returns a new rodCoord object. The error message is returned if the input value is invalid.

Example

; Call rodCoordToString with second argument t to generate a string in the needed format:
rodCoordToString(coord t)
=> "1.22502@100000"
; Then pass this string to rodCoordParseString:
rodCoordParseString("1.22502@100000")
=> rodCoord@0x1b211400 ; rodCoord created (equal to the original rodcoord object).

rodCoordPartition

rodCoordPartition(
o_dividend 
g_divisor
);end rodCoordPartition
=> l_result

Description

Performs a division on the given arguments – dividend and divisor.

Arguments

o_dividend

Specifies a rodCoord object used as the dividend (numerator) for division.

g_divisor

Specifies a rodCoord object or a fixed number value used as the divisor (denominator) for division. If the divisor value is a fixed number it is used as a fixed number and not converted to rodCoord before applying the division. A zero value is not accepted.

Value Returned

l_result

A list containing two rodCoord objects – integer quotient and remainder.

Example

rodCoordPartition(coord1  coord2)
=> (rodCoord@0x018ef28  rodCoord@0x018ef68)

In this example, a division on the given arguments dividend and divisor is performed.

rodCoordSnap

rodCoordSnap(
o_rodCoord
[[ S_snapType ] 
[ n_gridValue ]]
);end rodCoordSnap
=> o_rodCoord

Description

Snaps a rodCoord object so that its value is on the grid.

Arguments

o_rodCoord

A rodCoord object.

S_snapType

A symbol representing the snap type (ROUND, TRUNCATE, CEILING)

ROUND – Converts the value to the nearest arithmetic unit with the mid-point value rounding away from the zero grid point.
TRUNCATE – Converts the value to the next arithmetic unit towards the zero grid point.
CEILING – Converts the value to the next larger arithmetic unit towards positive infinity.

Default value: TRUNCATE.

n_gridValue

Specifies a fixed or floating number in user units that defines the grid value. If n_gridValue is not specified, the grid value (global) is set using the rodCoordDefineGrid function.

However, if the global grid value is not set and the rodCoordSnap function is called without the third argument, the SKILL error is returned.

Value Returned

o_rodCoord

A new rodCoord object is returned. A SKILL error is returned if the input value is invalid.

Example

rodCoordSnap(coord1)
=> rodCoord@0x016036

In this example, a specified o_rodCoord object is snapped.

rodCoordToFloat

rodCoordToFloat(
o_rodCoordObj 
);end rodCoordToFloat
=> f_value

Description

Returns the rodCoord data in user unit as floating point number.

Arguments

o_rodCoordObj

Specifies a valid rodCoord object.

Value Returned

f_value

A floating point number is returned. A SKILL error is returned if the input value is invalid.

Example

rodCoordToFloat(coord1)
=> 1.25

In this example, a floating point number is returned.

rodCoordToInt

rodCoordToInt(
o_rodCoordObj 
);end rodCoordToInt
=> x_value

Description

Returns the rodCoord data in user unit as a fixed number.

Arguments

o_rodCoordObj

Specifies a valid rodCoord object.

Value Returned

f_value

A fixed number is returned. A SKILL error is returned if the input value is invalid.

Example

rodCoordToFloat(coord1)
=> 1

In this example, a fixed number is returned.

rodCoordToString

rodCoordToString(
o_rodCoordObj 
[ g_dumpAR ]
);end rodCoordToString
=> t_value

Description

Returns a string containing the rodCoord data in user unit as floating number.

Arguments

o_rodCoordObj

Specifies a valid rodCoord object.

g_dumpAR

If set to t, the string is dumped in the arithmetic resolution, <number>@<ar> format. You can then pass this string to the rodCoordParseString function to restore the rodCoord object.

Value Returned

f_value

A string value returned. A SKILL error is returned if the input value is invalid.

Example

rodCoordToFloat(coord1)
=> “1.25”

In this example, a string containing the rodCoord data in user unit as floating number is returned.

rodCoordToFloat(coord1 t)
=> “1.25@1000”

In this example, a string containing the rodCoord data is dumped as 1.25@1000.


Return to top
 ⠀
X