
! script name: plot.d/plotcomponent
! topic: Sample - plot geometry associated with a component

!A
!A NAME:
!A
!A 	plotcomponent
!A
!A DESCRIPTION:
!A
!A 	script for plotting geometry associated with a component
!A
!B INSTRUCTIONS:
!B
!B 	NO HELP AVAILABLE AT THIS TIME
!B
!C NOTE:
!C
!C 	This is an unsupported sample script.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: plotcomponent ")

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

CALL Convert_old_origins
Start:!

Stat=UserSelectBox("COMPONENTS","selected component",WsComponent,WsUserSelect)
IF Stat=1 THEN Leave

Stat=SetInputFormat("a99","")
Stat=GetValue("INPUT COMPONENT NAME",Name$)
IF (ExitScript(Destination$)) THEN Leave

Component=FindUserData(Name$,WsComponent)

Stat=SetPlotLayers("")
Stat=SetPlotColors("")

Stat=PlotAssocEnt(Component,10000)

Leave:!

LowerSelectBox


IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END

SUB Convert_old_origins
DIM Answer$[256]
DIM Zone_name$[256]

G1= UserDataGroup(WsWorkZoneOrigin)
IF NOT ValidGeometry(G1) THEN SUBEXIT
Num_origins= GroupCount(G1)

FOR I= 1 TO Num_origins
        E1= GroupElement(G1,I)
        IF CheckUserField(E1,"Class id number:",1) THEN Next_i
        Group1= GrpByProp(E1,WsWorkZoneOrigin)
        IF NOT ValidGeometry(Group1) THEN Next_i
        IF NOT GroupCount(Group1) THEN Next_i
	GOTO End_it
Next_i: NEXT I
Stat=DeleteEntity(G1)
SUBEXIT
End_it:	Answer$="/usr/weber/database/messages/convert_old_zones"
	Stat=MessageFileBox(Answer$,"INFORMATION")
	Stat=DeleteEntity(G1)
	Stat=DeleteEntity(Group1)
SUBEND
