
! script name: draft.d/hatchdata
! topic: edit variables associated with crosshatching boundaries

!A
!A NAME:
!A
!A 	Hatch Data
!A
!A DESCRIPTION:
!A
!A 	This script allows the variables associated with the crosshatching
!A 	boundarys to be edited.
!A
!A~ image location - images/hatchdata.gif
!A
!B INSTRUCTIONS:
!B
!B	HATCH PATTERN:
!B		Patterns 0-9 are single parallel lines spaced by the hatch
!B 		width. Line types vary from 0-9.
!B
!B		Patterns 10-19 are double lines, the second line is spaced
!B 		1/3 the hatch width from the first line.  The first line is
!B 		solid.  The line type, of the second line, varies from 0-9.
!B
!B		Patterns 20-29 are crosshatching patterns, two sets of lines
!B 		perpendicular to each other.  The line types vary from 0-9.
!B
!B	HATCH WIDTH: Enter the parallel spacing of the patterns.
!B
!B	HATCH ANGLE: Enter the angle of the hatching lines.
!B		
!B	HATCH PEN: Enter the color of hatch pattern.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: crosshatch data ")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
REAL Leadintype
REAL Leadouttype

Units= CurrentUnits

IF Units= WsMetric THEN
        Hwidth= 6.25
ELSE
        Hwidth= 0.25
END IF

HatchVarsType= 20021

Hatch_pattern= 1
Hwidth= 0.25
Angle= 60
Hatch_pen= 19

Hatch_pattern=NamedVarVal("Hatch pattern",HatchVarsType,Hatch_pattern)
Hwidth=NamedVarVal("Hatch width",HatchVarsType,Hwidth)
Angle=NamedVarVal("Hatch angle",HatchVarsType,Angle)
Hatch_pen=NamedVarVal("Hatch color",HatchVarsType,Hatch_pen)

V1=CreateVariable("Hatch pattern",HatchVarsType,Hatch_pattern)
V2=CreateVariable("Hatch width",HatchVarsType,Hwidth)
V3=CreateVariable("Hatch angle",HatchVarsType,Angle)
V4=CreateVariable("Hatch color",HatchVarsType,Hatch_pen)


Start:!
HatchVarsType= 20021

Stat=UserSelectBox("NAMED VARIABLES","selected variable",HatchVarsType,WsVarSelect)
IF Stat=1 THEN Leave

Stat=SetInputFormat("a99","")
Stat=GetValue("NAME OF VARIABLE TO BE EDITED",Name$)
IF ExitScript(Destination$) THEN Leave
IF (Name$="CANCEL") THEN Leave

N=POS(Name$,"=")
IF (N>1) THEN
	Name$=Name$[1,N-1]
	Name$=TRIM$(Name$)
END IF

Edit_var=FindNamedVar(Name$,HatchVarsType)
IF (NOT ValidGeometry(Edit_var)) THEN Start

LowerSelectBox

SELECT NamedVarTyp(Edit_var)
CASE WsRealVar
	Stat=SetInputFormat("n4=","")
	A=GetVariableVal(Edit_var)
	Stat=SetEqualsValue(A)
	A=GetValue("INPUT "&Name$,Answer$)
	IF (ExitScript(Destination$)) THEN Leave
	Stat=PutVariableVal(Edit_var,A)

CASE WsStringVar
	Stat=SetInputFormat("a99=","")
	Stat=GetVariableStr(Edit_var,Answer$)
	Stat=SetEqualsValue(A,Answer$)
	A=GetValue("INPUT "&Name$,Answer$)
	IF (ExitScript(Destination$)) THEN Leave
	Stat=PutVariableStr(Edit_var,Answer$)

CASE WsGeometryVar
	E1=PickEntity("PICK GEOMETRY ELEMENT "&Name$)
	IF (ExitScript(Destination$)) THEN Leave
	Stat=PutVariablePtr(Edit_var,E1)

END SELECT

GOTO Start

Leave:!

LowerSelectBox

IF (NOT LEN(Destination$)) THEN
	 LOAD "draft.d/crosshatch"
ELSE
	 LOAD Destination$
END IF
END

