
! script name: groups.d/makepltgrp
! topic: make plot group

!A
!A NAME:
!A
!A 	MAKE PLOT GROUP
!A
!A DESCRIPTION:
!A
!A 	This script makes a plot group.  All geometry on a specified
!A 	layer in a particular color will be made into the plot group.
!A
!B INSTRUCTIONS:
!B
!B 	INPUT PLOT GROUP NAME: Enter the name to be associated with the
!B 		plot group.
!B
!B 	INPUT LAYERS VISIBLE: Enter the layers that are visible for the
!B 		plot group.
!B
!B 	INPUT COLORS VISIBLE: Enter the colors that are visible for the
!B 		plot group.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: make plot group ")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM Datastr$[1026]
DIM Layers$[256]
DIM Colors$[256]
DIM Components$[256]
DIM Assemblys$[256]

Use_Components=0
Use_Assemblys=0

Start:!

Stat=UserSelectBox("CURRENT PLOT GROUPS","selected group",WsPlotGroup,WsUserData)

Stat=SetInputFormat("a99","",Wsfalse)
Stat=GetValue("INPUT PLOT GROUP NAME",Name$)
IF (ExitScript(Destination$)) THEN Leave
IF Name$="CANCEL" THEN Leave

IF Use_Assemblys THEN
	Stat=SetInputFormat("a99","",Wsfalse)
	Stat=GetValue("INPUT ASSEMBLIES VISIBLE, All",Assemblys$)
	IF (ExitScript(Destination$)) THEN Leave
	IF Assemblys$="CANCEL" THEN Leave
END IF

IF Use_Components THEN
	Stat=SetInputFormat("a99","",Wsfalse)
	Stat=GetValue("INPUT COMPONENTS VISIBLE, All",Components$)
	IF (ExitScript(Destination$)) THEN Leave
	IF Components$="CANCEL" THEN Leave
END IF


Stat=SetInputFormat("a99","",Wsfalse)
Stat=GetValue("INPUT LAYERS VISIBLE, All",Layers$)
IF (ExitScript(Destination$)) THEN Leave
IF Layers$="CANCEL" THEN Leave


Stat=SetInputFormat("a99","",Wsfalse)
Stat=GetValue("INPUT COLORS VISIBLE, All",Colors$)
IF (ExitScript(Destination$)) THEN Leave
IF Colors$="CANCEL" THEN Leave


Datastr$=" PLOT GROUP "&CHR$(10)
Datastr$=Datastr$&" "&CHR$(10)
Datastr$=Datastr$&"NAME: "&Name$&CHR$(10)
IF Use_Assemblys THEN
	Datastr$=Datastr$&"ASSEMBLIES: "&Assemblys$&CHR$(10)
END IF
IF Use_Components THEN
	Datastr$=Datastr$&"COMPONENTS: "&Components$&CHR$(10)
END IF
Datastr$=Datastr$&"LAYERS: "&Layers$&CHR$(10)
Datastr$=Datastr$&"COLORS: "&Colors$&CHR$(10)

Pltgrp=FindUserData(Name$,WsPlotGroup)
IF (NOT (ValidGeometry(Pltgrp))) THEN
	Pltgrp=ReadUserData(WsPlotGroup,Name$,Datastr$)
ELSE
	IF Use_Assemblys THEN
		Stat=PutUserString(Pltgrp,"ASSEMBLIES:",Assemblys$)
	END IF
	IF Use_Components THEN
		Stat=PutUserString(Pltgrp,"COMPONENTS:",Components$)
	END IF
	Stat=PutUserString(Pltgrp,"LAYERS:",Layers$)
	Stat=PutUserString(Pltgrp,"COLORS:",Colors$)
END IF

GOTO Start

Leave:!

LowerSelectBox

Stat=SetInputFormat("n4=","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
