
! script name: colors.d/colorgroup
! topic: assign color to elements in box

!A
!A NAME:
!A
!A 	Color in Box
!A
!A DESCRIPTION:
!A
!A 	This script allows a box to be made around the elements to be
!A 	colored.  If part of an element is inside the view box, the
!A 	entire element is colored.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT VIEW FOR SELECTION BOX: Pick the view that elements will be
!B 		colored in.
!B
!B 	PICK FIRST CORNER OF PICK ZONE: Pick a corner of the box.
!B
!B 	PICK SECOND CORNER OF PICK ZONE: Pick the other corner of the view box.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: color in box ")

DIM Answer$[256]
DIM Destination$[256]
DEG

ActivateUndo
Pen_color= CurrentColor
IF ARGC<2 THEN RaiseColorBox

Group_loop:!
Group=CreateGroup("TEMPGROUP")

Vnum= LastPickView
Stat=PickBox(Group,Vnum,WsPickPen)
IF (ExitScript(Destination$)) THEN Leave


ActivateUndo
Stat= AdvanceUndoNumber("color group")
Stat= AddGroupToUndo(WsUBModifyMode,Group,0,WsFalse)

Stat=SetColor(Group)
Stat=DeleteEntity(Group)

GOTO Group_loop

Leave:!
LowerColorBox
Stat=DeleteEntity(Group)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END


