
! script name: layers.d/assemblybox
! topic: set assembly numbers on a group of elements in box

!A
!A NAME:
!A
!A 	Assembly in Box
!A
!A DESCRIPTION:
!A
!A 	This script allows a group of elements within a box to be assigned
!A	a assembly number.
!A
!B INSTRUCTIONS:
!B
!B 	ASSEMBLY NUMBER,   current assembly= # : Enter the assembly number 
!B 		to be assigned to the elements selected.
!B
!B 	SELECT VIEW FOR SELECTION BOX: Pick the view that the elements are in.
!B

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

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

ActivateUndo
Assembly=CurrentAssembly

stat= SetInputFormat("n0=","")
stat= SetEqualsValue(Assembly)
Assembly=GetValue("ASSEMBLY NUMBER,   current assembly= "&VAL$(Layer))
IF (ExitScript(Destination$)) THEN Leave
stat= SetInputFormat("n4","")

Group_loop:!
Group=CreateGroup("TEMPGROUP")


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

ActivateUndo
Stat= AdvanceUndoNumber("set assembly")
Stat= AddGroupToUndo(WsUBModifyMode,Group,0,WsFalse)

Stat=SetAssembly(Group,Assembly)
Stat=DeleteEntity(Group)

GOTO Group_loop

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


