I hope the following comments help:
- ([color=BLUE]defun[/color] c:UTM2KFS ( [color=BLUE]/[/color] sel1 ) [color=GREEN];; Define function, declare local variables.[/color] [color=GREEN];; To understand why variable localisation is important, see http://bit.ly/15Qw104[/color] ([color=BLUE]if[/color] [color=GREEN];; If the following expression returns a non-nil value[/color] ([color=BLUE]setq[/color] sel1 ([color=BLUE]ssget[/color] [color=MAROON]"_P"[/color])) [color=GREEN];; Attempt to retrieve the Previous selection set and[/color] [color=GREEN];; assign the selection set to the local variable 'sel1'[/color] [color=GREEN];; For a full ssget function reference, see http://bit.ly/137NmOJ[/color] [color=GREEN];; The following command expression is the THEN argument for the IF function:[/color] ([color=BLUE]command[/color] [color=GREEN];; Issue the following to the AutoCAD command-line[/color] [color=MAROON]"_.move"[/color] [color=GREEN];; Start the Move command.[/color] [color=GREEN];; See http://bit.ly/18cyqA3 for the meaning of the command prefixes[/color] sel1 [color=GREEN];; Supply the move command with the selection set assigned to local variable sel1[/color] [color=GREEN];; The variable symbol will be evaluated as an argument for the command function,[/color] [color=GREEN];; yielding the selection set value.[/color] [color=MAROON]""[/color] [color=GREEN];; Accept the selection (ENTER)[/color] [color=MAROON]"_non"[/color] [color=GREEN];; Ignore Object Snap for the next prompt (_non = None)[/color] '(357351.181 5957636.884) [color=GREEN];; Pass the base point[/color] [color=MAROON]"_non"[/color] [color=GREEN];; Ignore Object Snap[/color] '(5000 1000) [color=GREEN];; Pass the displacement point[/color] [color=MAROON]"_.rotate"[/color] [color=GREEN];; Start the Rotate command.[/color] [color=GREEN];; (There is no need for a separate command expression)[/color] sel1 [color=GREEN];; Pass the same selection set of objects[/color] [color=MAROON]""[/color] [color=GREEN];; Accept the selection[/color] [color=MAROON]"_non"[/color] [color=GREEN];; Ignore Object Snap[/color] '(5000 1000) [color=GREEN];; Pass the base point[/color] 3.415 [color=GREEN];; Pass the rotation angle (in degrees)[/color] [color=MAROON]"_.scale"[/color] [color=GREEN];; Start the Scale command[/color] [color=GREEN];; (Again, no need for a separate command expression)[/color] sel1 [color=GREEN];; Pass the same selection set of objects[/color] [color=MAROON]""[/color] [color=GREEN];; Accept the selection[/color] [color=MAROON]"_non"[/color] [color=GREEN];; Ignore Object Snap[/color] '(5000 1000) [color=GREEN];; Pass the base point[/color] 1.00024606053 [color=GREEN];; Pass the scale factor[/color] ) [color=GREEN];; end COMMAND[/color] [color=GREEN];; The following expression is the ELSE argument for the IF function:[/color] ([color=BLUE]princ[/color] [color=MAROON]"\nNo previous selection."[/color]) [color=GREEN];; Notify the user that no previous selection set is available[/color] ) [color=GREEN];; end IF[/color] ([color=BLUE]princ[/color]) [color=GREEN];; Suppress the return of the last evaluated expression[/color] ) [color=GREEN];; end DEFUN[/color]
|