
! script name: subassembly.d/setsubassembly
! topic: assign single element to sub-assembly

!A
!A NAME:
!A
!A 	Assign Sub-Assembly
!A
!A DESCRIPTION:
!A
!A 	This script allows a single element to be assigned to a sub-assembly.
!A
!B INSTRUCTIONS:
!B
!B 	SUB-ASSEMBLY NUMBER,   current subassembly= # : Enter the sub-assembly
!B		number to be assigned to the element selected.
!B
!B 	PICK ELEMENT TO BE ASSIGNED SUB-ASSEMBLY #: Pick the element to be
!B 		assigned to the sub-assembly.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: assign sub-assembly ")

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

SubAssembly=CurrSubAssembly

ActivateUndo
Start:!
Stat= SetInputFormat("n0a99","")
SubAssembly=InputSubAssembly("SUB-ASSEMBLY NUMBER, current subassembly= "&VAL$(SubAssembly),Answer$)
IF (ExitScript(Destination$)) THEN Leave
LowerSelectBox

Ploop:!
Stat=SetInputFormat("n4","")

E1=PickEntity("PICK ELEMENT TO BE ASSIGNED SUB-ASSEMBLY "&VAL$(SubAssembly))
IF (ExitScript(Destination$)) THEN Leave


ActivateUndo
Stat= AdvanceUndoNumber("set sub assembly")
Stat= AddItemToUndo(WsUBModifyMode,E1)

Stat=SetSubAssembly(E1,SubAssembly)

GOTO Ploop

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