
! script name: groups.d/makecomponent
! topic: Sample - script for making a component

!A
!A NAME:
!A
!A 	makecomponent
!A
!A DESCRIPTION:
!A
!A 	NO HELP AVAILABLE AT THIS TIME
!A
!B INSTRUCTIONS:
!B
!B 	questions with brief description
!B
!C NOTE:
!C
!C 	This is an unsupported sample script.
!C

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

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

File_name$="/usr/weber/util/tooldata/components/general"

Start:!


Stat=UserSelectBox("CURRENT COMPONENTS","selected component",WsComponent)

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


Component=FindUserData(Name$,WsComponent)
IF (NOT (ValidGeometry(Component))) THEN
	Component=ReadUserData(WsComponent,Name$,File_name$)
	 Stat=GetUserString(Component,"Name:",Answer$)
	Stat=PutUserString(Component,"Name:",Answer$)
END IF

Group=CreateGroup("TEMPGROUP")

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

Stat=AssocUserData(Group,Component,10000)

Stat=DeleteEntity(Group)

GOTO Start

Leave:!

LowerSelectBox

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

