
! script name: vgeomtol.d/angularity
! var_topic: angularity feature box

!A
!A NAME:
!A
!A 	Angularity	VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script makes an angularity feature box.
!A
!A~ image location - images/angularity.gif
!A
!B INSTRUCTIONS:
!B
!B 	ANGULARITY TOLERANCE: Enter the angularity tolerance to be
!B 		entered in the feature box, for drafting purposes only.
!B
!# see also - geomtol.d/geominfo.hlp

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

DIM Answer$[256]
DIM Destination$[256]
DIM A$[256]
DIM Toler$[256]
DIM Datum$[30]
DIM Symbol$[30]
DIM Material$[30]
DIM Point$[256]
DIM Name$[256]
DEG


Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave

ActivateUndo
Nsym= 145
Tol= 0.010

Text_loop:!

Symbol$= CHR$(Nsym)

Stat= SetEqualsValue(Tol)
Stat=SetInputFormat("n4=","")
Tol= GetValue("ANGULARITY TOLERANCE",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetInputFormat("a3",",LMC,MMC,RFS,N,")
stat= GetValue("MATERIAL CONDITION  LMC , MMC , RFS , None ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "N", "None", "NONE"
	Material$= ""
CASE  "RFS"
	Material$= CHR$(138)
CASE  "LMC"
	Material$= CHR$(137)
CASE  "MMC"
	Material$= CHR$(136)
END SELECT
Toler$= VAL$(Tol)&CHR$(31)&" "&Material$



Stat=SetInputFormat("a99","")
stat= GetValue("DATUM, A B C D E F G   None ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "N", "None", "NONE"
        Datum$=""
CASE ELSE
	Stat= BackSlashChars(Answer$,A$)
	Stat= ReplaceString(A$,"\n",CHR$(10),Answer$)
        Datum$= UPC$(Answer$)
END SELECT


Pick_point:!
E1=PickEntity("PICK LOCATION")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidDependency(E1) THEN Pick_point
T1= LastPickPara
Pick_return= CurrPickReturn
Stat= EntityNameCheck(E1,Point$)


Stat= GenerateVarName("D",Name$)
RecordFunctionOn
Stat= RecordDescr("GEOMETRIC TOL: Angularity")
Stat= SetRecDelLastExec
SELECT Pick_return
CASE WsGeometryEnd
        Pc= ParameterReturnPt(Point$,T1,WsGeometryEnd)
CASE WsGeometryMid
        Pc= ParameterReturnPt(Point$,T1,WsGeometryMid)
CASE WsGeomCenter
        Pc= ParameterReturnPt(Point$,T1,WsGeomCenter)
END SELECT
V0= FreeParameter("Table origin",Tableorig)
IF LEN(Datum$) THEN
	V1= StringConstant(Symbol$)
	V2= StringConstant(Toler$)
	V3= StringConstant(Datum$)
	E1= FeatureControlBox(Pc,V0,V1,V2,V3)
ELSE
	V1= StringConstant(Symbol$)
	V2= StringConstant(Toler$)
	E1= FeatureControlBox(Pc,V0,V1,V2)
END IF
Stat=DeleteEntity(Pc)
Stat= NameEntity(E1,Name$)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord
IF NOT ValidGeometry(E1) THEN
        DelLastVarRecord
ELSE
	ActivateUndo
	Stat= AdvanceUndoNumber("angularity")
	Stat= AddDimToUndo(WsUBCreateMode,E1)
	Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
END IF

Stat= PlotEntity(Point$)

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