
! script name: draft.d/setdrafttol
! topic: set drafting tolerance data

!A
!A NAME:
!A
!A 	Dimension Tolerances
!A
!A DESCRIPTION:
!A
!A 	This script sets drafting tolerance data.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT OPTION: The TOLERANCE FORMATS selection box
!B 		will automatically appear to allow a selection.
!B 		The following are the present choices:
!B
!B 			NO TOLERANCE
!B 			ONE LINE LIMIT DIMS
!B 			OVER UNDER LIMIT DIMS
!B 			OVER UNDER TOLERANCES
!B 			UNIFORM TOLERANCE
!B			ONE LINE INCH METRIC
!B			ONE LINE INCH METRIC BRACKETS
!B			OVER UNDER INCH METRIC
!B			OVER UNDER INCH METRIC BRACKETS
!B
!B 		These selections change the way dimensions appear.
!B
!B 		NO TOLERANCE - This turns off the switch to include tolerances
!B 		        in the dimension box.
!B 		ONE LINE LIMIT DIMS - This will put the available range on a
!B 		        single line.
!B 		OVER UNDER LIMIT DIMS - This places the upper range of the
!B 		        number over the lower range of the number.
!B 		OVER UNDER TOLERANCES - This places the positive tolerance
!B 		        above the negative tolerance, next to the dimension.
!B 		UNIFORM TOLERANCE: The positive tolerance will be used
!B 			for the upper and lower tolerance range.
!B		ONE LINE INCH METRIC: Inch/Metric dimensions on one line.
!B		ONE LINE INCH METRIC BRACKETS: Inch/Metric dimensions 
!B			on one line. Other dim bracketed.
!B		OVER UNDER INCH METRIC Inch over Metric dimensions.
!B		OVER UNDER INCH METRIC BRACKETS Inch over Metric
!B 			dimensions.  Other dim bracketed.
!B
!B 	POSITIVE TOLERANCE: Enter the allowable positive tolerance
!B 		to be used in the labeling of dimensions.
!B
!B 	NEGATIVE TOLERANCE: Enter the allowable negative tolerance
!B 		to be used in the labeling of dimensions.
!B
!C NOTES: 
!C
!C 	+/+ and -/- TOLERANCES.
!C
!C 	Normally both positive and negative tolerances are answered with
!C 	positive answers and the signs are added automatically.
!C
!C 	Answering a negative number for a tolerance will reverse its sign.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: dimension tolerances ")

DIM Answer$[256]
DIM Destination$[256]
DIM Dim_type$[256]
DIM Namelist$[2024]
DIM Title$[256]
DIM Label$[256]
DEG


Dim_loop:!

Title$="TOLERANCE FORMATS" 
Label$="FORMAT SELECTED"
Namelist$="NO TOLERANCE,"
Namelist$=Namelist$&"ONE LINE LIMIT DIMS,"
Namelist$=Namelist$&"OVER UNDER LIMIT DIMS,"
Namelist$=Namelist$&"OVER UNDER TOLERANCES,"
Namelist$=Namelist$&"UNIFORM TOLERANCE,"
Namelist$=Namelist$&"ONE LINE INCH METRIC,"
Namelist$=Namelist$&"ONE LINE INCH METRIC BRACKETS,"
Namelist$=Namelist$&"OVER UNDER INCH METRIC,"
Namelist$=Namelist$&"OVER UNDER INCH METRIC BRACKETS,"

Stat=GeneralListBox(Title$,Label$,Namelist$)
Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT OPTION",Answer$)
IF (ExitScript(Destination$)) THEN Leave

LowerSelectBox
stat= SetInputFormat("n4","")

SELECT Answer$
CASE "NO TOLERANCE"
	Tol_type= 1
CASE "ONE LINE LIMIT DIMS"
	Tol_type= 4
CASE "OVER UNDER LIMIT DIMS"
	Tol_type= 2
CASE "OVER UNDER TOLERANCES"
	Tol_type= 3
CASE "UNIFORM TOLERANCE"
	Tol_type= 5
CASE "ONE LINE INCH/METRIC"
	Tol_type= 7
CASE "ONE LINE INCH METRIC BRACKETS"
	Tol_type= 8
CASE "OVER UNDER INCH METRIC"
	Tol_type= 9
CASE "OVER UNDER INCH METRIC BRACKETS"
	Tol_type= 10
CASE "CANCEL"
        LowerSelectBox
         LOAD "typecontrol"
END SELECT

SELECT Tol_type
CASE 2,3,4
        stat= SetInputFormat("n4=","")
        stat= SetEqualsValue(0)
        Plus_tol=GetValue("POSITIVE TOLERANCE",Answer$)
        IF (ExitScript(Destination$)) THEN Leave

        stat= SetEqualsValue(Plus_tol)
        Minus_tol=GetValue("NEGATIVE TOLERANCE",Answer$)
        IF (ExitScript(Destination$)) THEN Leave
CASE 5
        stat= SetInputFormat("n4=","")
        stat= SetEqualsValue(0)
        Plus_tol=GetValue("TOLERANCE",Answer$)
        IF (ExitScript(Destination$)) THEN Leave
        Minus_tol= Plus_tol
CASE ELSE
        Minus_tol=0
        Plus_tol=0
END SELECT

stat= SetDimTolerance(Tol_type,Plus_tol,Minus_tol)


Leave:!

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