Rack: GetCell
Get information about a given cell.
Function
Object GetCell(x: integer, y: integer)
Parameters
Name | Type | Description |
---|---|---|
x | Integer | The x coordinate of the cell to look up. 0 is the first column. |
y | Integer | The y coordinate of the cell to look up. 0 is the first row, the bottom of the rack. |
Return Value
An object that contains information about the location and dimensions of the specified cell. If the index is out of bounds for the rack, an Error is thrown. It has the following properties:
Property Name | Type | Description |
---|---|---|
X | Double | The X coordinate of the bottom left of the given cell, relative to the origin of the rack. In project units. |
Y | Double | The Y coordinate of the bottom left of the given cell, relative to the origin of the rack. In project units. |
Width | Double | The size of the cell going sideways in project units. |
Height | Double | The size of the cell going up in project units. |
Length | Double | The size of the cell going back in project units. This will be the same for every cell. |
Example
// Move a shape to the center of the cell in the second column, third row.
var rack = GetComponentByNameAndType("Rack1", "Rack");
var obj = rack.GetCell(1, 2);
var shape = GetComponentByNameAndType("BasicShape1", "Basic Shape");
shape.X = rack.X + obj.X + obj.Width / 2;
shape.Y = rack.Y;
shape.Z = rack.Z + obj.Y + obj.Height / 2;