Hi Bob,
I found a simple example for you. I created this script several years ago, it never proved to be useful, but it's simple enough to be used as a learning source. It's called "Grow Points Selection" - it finds all selected points and selects all their neighbours.
#command("object");
shape $Shapes[0], $S;
int $i, $j, $SelectedPts[0];
/* Find all the shapes in the current object and store them in the $Shapes array */
project.curObject.GetShapes($Shapes);
/* Loop through all the shapes */
while ($Shapes.size > 0) {
/* Remove the last item from the array */
$S = $Shapes.pop();
/* Continue only if the current shape is a mesh */
if ($S.GetKind() == SHAPE_KIND_MESH) {
$SelectedPts.size = 0;
/* Loop through all points of this shape */
for $i = 0 to $S.GetNumPoints()-1 do {
/* If the current point is selected, add it to the $SelectedPts array */
if ($S.GetPointSelected($i))
$SelectedPts.push($i);
}
/* Select all neighbour points of each point in the $SelectedPts array */
for $i = 0 to $SelectedPts.size-1 do {
for $j = 1 to $S.GetNumEdges() do {
if ($S.GetEdgeIndex0($j) == $SelectedPts[$i])
$S.SetPointSelected($S.GetEdgeIndex1($j), true);
else if ($S.GetEdgeIndex1($j) == $SelectedPts[$i])
$S.SetPointSelected($S.GetEdgeIndex0($j), true);
}
}
}
}
I tried to provide enough comments, if you have any questions I'll be happy to help you.
As for your questions... The pop and push functions are used to remove/add array items, as you can see from the example above. ASL arrays do not have a fixed size so you can always remove the last item by calling the pop() function or you can add a new item to the end of the array by calling the push() function.
The Marked property and SetXXXMarked() and GetXXXMarked() functions are something I've never used... Anyway, you can make any shape, texture, edge, face etc. "marked" or "unmarked" just like you can make certain components selected/unselected. The difference is that making things marked does not make them look differently, it's just an internal property you can use. It might be useful in very complex scripts where you need to keep track of many things...
Command scripts are not much different than parametric scripts or export scripts... The only difference is that you have a few extra functions available while some features (such as user input) are more restricted. As always, the ASL specification is your best friend