GetCommands
Returns all commands of the current path.
Syntax
expression.GetCommands();
expression - A variable that represents a ApiPath class.
Parameters
This method doesn't have any parameters.
Returns
Example
Retrieve all drawing commands from a custom shape path in a spreadsheet.
// How do I access every step in a shape's drawing sequence at once in a spreadsheet?
// Collect the full list of path instructions to inspect or process a shape's outline in a spreadsheet.
let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.RGB(100, 150, 200));
let stroke = Api.CreateStroke(18000, Api.CreateSolidFill(Api.RGB(50, 75, 100)));
let shape = worksheet.AddShape("star5", 60 * 36000, 60 * 36000, fill, stroke, 3, 0, 2, 0);
let geometry = shape.GetGeometry();
let path = geometry.GetPath(0);
let commands = path.GetCommands();
worksheet.GetRange("A8").SetValue("Commands: " + path.GetCommandCount());
let cmd = path.GetCommand(0);
worksheet.GetRange("A9").SetValue("Type: " + cmd.GetType() + " at (" + cmd.GetX() + ", " + cmd.GetY() + ")");