
! script name: vcontrol.d/setactiveobjgrp
! var_topic: set active object group

!A
!A NAME:
!A
!A      Set Active Object Group
!A
!A DESCRIPTION:
!A
!A	This script sets the active object group. When an active object
!A	group is set execution of the variational program is restricted
!A	to the active objects. It behaves much like turning variational
!A	calculations off for all objects not active. 
!A
!B INSTRUCTIONS:
!B
!B	INPUT ACTIVE NAME, None: Select the
!B 		active object group name. None will turn off
!B 		the active object group and return to the
!B 		default state of all objects active.
!B
!# see also - htdocs/help.d/vdminfo.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: set active object group")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]

DeActivateUndo
Highlight_color=4

Start:!
Stat=ListGrpNames("VARIATIONAL OBJECT GROUPS","selected group","",WsVarObjectGroup)
IF Stat=1 THEN Leave

Stat=SetInputFormat("a99","")
Stat=GetValue("INPUT ACTIVE NAME, None  ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Answer$= TRIM$(Answer$)
IF Answer$="CANCEL" THEN Leave
IF Answer$="N" OR Answer$= "n" OR Answer$="None" OR Answer$= "NONE" THEN 
	Stat= SetActiveVarObjGrp(0)
	GOTO Leave
END IF
Name$=Answer$

Group=FindNamedGrp(Name$)
IF (NOT ValidGeometry(Group)) THEN Start
Stat= SetActiveVarObjGrp(Group)
FOR I= 1 TO GroupCount(Group)
	E1= GroupElement(Group,I)
	Stat=Highlight(E1,Highlight_color,0)
NEXT I


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