
! script name: vgeomtol.d/concentric
! var_topic: concentricity feature box

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

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

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= 134
Units= CurrentUnits
Tol= 0.005
IF Units= WsMetric THEN Tol= 0.01

Text_loop:!
Symbol$= CHR$(Nsym)

Stat= SetEqualsValue(Tol)
Stat=SetInputFormat("n4=","")
Tol= GetValue("CONCENTRICITY 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$= CHR$(129)&" "&VAL$(Tol)&" "&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: Concentricity")
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("concentricity")
	Stat= AddDimToUndo(WsUBCreateMode,E1)
	Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
END IF

Stat= PlotEntity(Point$)

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