
! script name: linetypes.d/linetypegroup
! topic: assign line type to elements in box

!A
!A NAME:
!A
!A 	Line Type: Box
!A
!A DESCRIPTION:
!A
!A 	This script allows a group of elements in a box to have a line type
!A 	associated with them.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT LINE TYPE: The LINE TYPES options selection box will
!B 		automatically appear to allow the selection of a line type.
!B
!B 	SELECT VIEW FOR SELECTION BOX: Pick the view that elements will
!B 		be assigned the line type.
!B
!B 	PICK FIRST CORNER OF PICK ZONE: Pick a corner of the box.
!B
!B 	PICK SECOND CORNER OF PICK ZONE: Pick the other corner of the view box.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: line type box ")

DIM Destination$[256]
DIM Answer$[256]
DIM Namelist$[1000]
DIM Title$[256]
DIM Label$[256]

ActivateUndo
Line_type=CurrentLT
Start:!
IF OSystemId=2 THEN
        Line_type=CurrentLT
ELSE
Title$="LINE TYPES"
Label$="LINE TYPE SELECTED"
Namelist$=          "1  ________________________,"
Namelist$=Namelist$&"2  . . . . . . . . . . . . ,"
Namelist$=Namelist$&"3  .   .   .   .   .   .  .,"
Namelist$=Namelist$&"4  ........................,"
Namelist$=Namelist$&"5  __ __ __ __ __ __ __ __ ,"
Namelist$=Namelist$&"6  __ _  __ _  __ _ __ _ __,"
Namelist$=Namelist$&"7  __ .  __ .  __ . __ . __,"
Namelist$=Namelist$&"8  __ .. __ .. __ .. __ .. ,"
Namelist$=Namelist$&"9  WIDE ___________________,"
Namelist$=Namelist$&"10 XWIDE __________________,"
Namelist$=Namelist$&"11 XXWIDE _________________,"
Namelist$=Namelist$&"12 WIDE __ __ __ __ __ __ _,"
Namelist$=Namelist$&"13 ____  _____ _____ _____ ,"
Namelist$=Namelist$&"14 ____ . _____ . _____ . _,"
Namelist$=Namelist$&"15 ____ .. _____ .. _____ .,"
Namelist$=Namelist$&"16 ___ ___ _ _ ___ ___ _ _ ,"
Namelist$=Namelist$&"17 ___ ___ .. ___ ___ ..   ,"
Namelist$=Namelist$&"18 ____ ____ _ _ ____ ____ _ _,"
Namelist$=Namelist$&"19 _____ ... _____ ... ,"

Stat=GeneralListBox(Title$,Label$,Namelist$)
Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT LINE TYPE",Answer$)
IF ExitScript(Destination$) THEN Leave
IF Answer$="CANCEL" THEN Leave

ON ERROR GOTO Start

Ltype= VAL(Answer$)
IF Ltype<1 OR Ltype>19 THEN Start
Stat=SetCurrentLT(Ltype)
LowerSelectBox
END IF


Ploop:!

Group=CreateGroup("TEMP")

Stat=SetInputFormat("n4","")

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

ActivateUndo
Stat= AdvanceUndoNumber("linetype group")
Stat= AddGroupToUndo(WsUBModifyMode,Group,0,WsFalse)

Stat=LTypeContour(Group)
Stat=DeleteEntity(Group)

GOTO Ploop

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