
! script name: layers.d/setassembly
! topic: assign single element to assembly

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

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

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

ActivateUndo
Assembly=CurrentAssembly

Stat=SetInputFormat("n0=","")
Assembly=InputAssembly("ASSEMBLY NUMBER,   current assembly= "&VAL$(assembly))
IF (ExitScript(Destination$)) THEN Leave

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

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

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

Stat=SetAssembly(E1,assembly)

GOTO Ploop

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