
! script name: colors.d/colorconcrev
! topic: assign color revolutions having colinear axii.

!A
!A NAME:
!A
!A 	Color in Box by Concentric Revolutions
!A
!A DESCRIPTION:
!A
!A	This script will color all revolutions in a box which have
!A	axes which are colinear with the given revolution.
!A
!B INSTRUCTIONS:
!B
!B	PICK REVOLUTION: Pick the revolution to determine the axes.
!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 concentric revolutions ")

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

ActivateUndo
Units= CurrentUnits
IF Units= WsMetric THEN
	Tol= 0.003
ELSE
	Tol= 0.0002
END IF

Min_angle= 170
Start:!

E1=PickEntity("PICK REVOLUTION")
IF (ExitScript(Destination$)) THEN Leave
Etype= EntityType(E1)
IF Etype<> WsRevolutionEnt THEN Start


Pen_color= CurrentColor
RaiseColorBox

Group_loop:!
Group=CreateGroup("TEMPGROUP")

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

Group1= ConcentricRevGrp(Group,E1,Min_rev)

ActivateUndo
Stat= AdvanceUndoNumber("color conc rev")
Stat= AddGroupToUndo(WsUBModifyMode,Group1,0,WsFalse)

Stat=SetColor(Group1)
Stat= PlotEntity(Group1)
Stat=DeleteEntity(Group)
Stat=DeleteEntity(Group1)
GOTO Start

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


