home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 March
/
Chip_1998-03_cd.bin
/
tema
/
MINICAD
/
MC7DEMO
/
MINICAD.1
/
CRE_FCF.MPC
< prev
next >
Wrap
Text File
|
1997-04-30
|
20KB
|
1,073 lines
Procedure CreateFCF;
{
(c)1997, Diehl Graphsoft, Inc.
Developed by Tom Urie
This procedure creates a geometric tolerancing Feature Control Frame.
}
LABEL 1,10,20,80,90,99;
CONST
CharWC = 0.09;
ClearWC = 0.07;
DiaLC = 0.17;
MCWC = 0.15;
STolWC = 0.25;
{The next two constants define the size of the geometric characteristic area}
GCSBoxLgthC = 0.34;
GCBoxHgtC = 0.2;
VAR
BoxHgt,GCBoxHgt : REAL;
GCSBoxLgth,TBoxLgth,DRBoxLgth : REAL;
CharW, ClearW,DiaL,DRefL,MCW,PTZL,TolL,STolW : REAL;
h,h1,x0,y0,x1,y1,xt,yt : REAL;
xb1,xb2,yb1,yb2,LScale : REAL;
Width,sx1,sy1,sx2,sy2,px1,px2,px3,px4,py1,py2,py3,py4 : INTEGER;
nTolDialog,nDRefDialog,GeoSymNum : INTEGER;
ID2,i,n,TAreas,DAreas,TxtSize : INTEGER;
TMCSymNum : ARRAY[1..2] OF INTEGER;
DRMCSymNum : ARRAY[1..3] OF INTEGER;
RFlag : ARRAY[1..4] OF INTEGER;
Abort,BigBox : BOOLEAN;
TDia,StatTol,PTZ : ARRAY[1..2] OF BOOLEAN;
GCSymName : ARRAY[1..15] OF STRING;
PTZHgt,Tol : ARRAY[1..2] OF STRING;
DRef : ARRAY[1..3] OF STRING;
DiaChar : CHAR;
LayerH,TextH : HANDLE;
GroupH : ARRAY[1..5] OF HANDLE;
UPI : REAL;
Fmt : INTEGER;
UM,UM2 : STRING;
UName,DA : LONGINT;
Procedure AlignScr(Width:INTEGER; VAR x1,x2:INTEGER);
{
This procedure centers the dialog boxes on the screen.
}
VAR
scrx1,scry1,scrx2,scry2 : INTEGER;
BEGIN
GetScreen(scrx1,scry1,scrx2,scry2);
x1:=((scrx1+scrx2) div 2)-(Width div 2);
x2:=x1+Width;
END;
Procedure LocateButtons(DialogType,scnh,scnw : INTEGER);
{
This procedure locates the 'OK' and 'Cancel' buttons.
}
VAR
v1,v2,v3,v4 : INTEGER;
Mac : BOOLEAN;
Procedure Swap(VAR m1,m2,m3,m4 : INTEGER);
VAR
Temp : INTEGER;
BEGIN
Temp:=m1;
m1:=m3;
m3:=Temp;
Temp:=m2;
m2:=m4;
m4:=Temp;
END; {of Swap}
BEGIN
Mac:=FALSE;
GetVersion(v1,v2,v3,v4);
IF v4 = 1 THEN Mac:=TRUE;
IF DialogType = 1 THEN
BEGIN
px1:=(scnw DIV 2) - 80;
px2:=(scnw DIV 2) - 10;
px3:=(scnw DIV 2) + 10;
px4:=(scnw DIV 2) + 80;
IF Mac THEN SWAP(px1,px2,px3,px4);
py1:=scnh-40;
py2:=scnh-20;
py3:=py1;
py4:=py2;
END ELSE IF DialogType = 2 THEN
BEGIN
px1:=scnw - 180;
px2:=scnw - 110;
px3:=scnw - 90;
px4:=scnw - 20;
IF Mac THEN SWAP(px1,px2,px3,px4);
py1:=scnh-40;
py2:=scnh-20;
py3:=py1;
py4:=py2;
END ELSE
BEGIN
px1:=scnw - 90;
px2:=scnw - 20;
px3:=px1;
px4:=px2;
py1:=scnh -70;
py2:=scnh - 50;
py3:=scnh - 40;
py4:=scnh - 20;
IF Mac THEN SWAP(py1,py2,py3,py4);
END;
END; {of Locate Buttons}
{
The following procedures create the various dialog boxes.
}
Procedure GeomSymDialog;
{
This procedure creates the main dialog box.
}
Procedure MakeGeomSymDialog;
CONST
sy1=100;
scnh=270;
scnw=430;
DialogType = 2;
VAR
h : INTEGER;
BEGIN
AlignScr(scnw,sx1,sx2);
sy2:=sy1+scnh;
LocateButtons(DialogType,scnh,scnw);
BeginDialog(1,1,sx1,sy1,sx2,sy2);
AddButton('OK',1,1,px1,py1,px2,py2);
AddButton('Cancel',2,1,px3,py3,px4,py4);
h:=35;
AddField('Geometric Characteristic:',5,1,20,44-h,290,60-h);
AddButton('Angularity',6,3,20,65-h,125,80-h);
AddButton('Circularity',7,3,20,85-h,125,100-h);
AddButton('Concentricity',8,3,20,105-h,125,120-h);
AddButton('Cylindricity',9,3,20,125-h,125,140-h);
AddButton('Flatness',10,3,20,145-h,125,160-h);
AddButton('Parallelism',11,3,135,65-h,270,80-h);
AddButton('Perpendicularity',12,3,135,85-h,270,100-h);
AddButton('Position',13,3,135,105-h,270,120-h);
AddButton('Profile Line',14,3,135,125-h,270,140-h);
AddButton('Profile Surface',15,3,135,145-h,270,160-h);
AddButton('Runout Circular',16,3,280,65-h,390,80-h);
AddButton('Runout Total',17,3,280,85-h,390,100-h);
AddButton('Straightness',18,3,280,105-h,390,120-h);
AddButton('Symmetry',19,3,280,125-h,390,140-h);
AddButton('None',20,3,280,145-h,390,160-h);
AddButton('Composite Characteristic Box',34,2,20,175-h,235,190-h);
AddField('No of Tolerance Areas:',21,1,20,205-h,180,220-h);
AddButton('1',22,3,20,225-h,50,240-h);
AddButton('2',23,3,60,225-h,90,240-h);
AddField('No of Datum Areas:',24,1,210,205-h,350,220-h);
AddButton('0',25,3,210,225-h,240,240-h);
AddButton('1',26,3,250,225-h,280,240-h);
AddButton('2',27,3,290,225-h,320,240-h);
AddButton('3',28,3,330,225-h,360,240-h);
EndDialog;
END;
BEGIN
MakeGeomSymDialog;
END;
Procedure TolAreaDialog(TAreas : INTEGER);
{
This procedure defines the Tolerance Area(s) dialog box.
}
Procedure MakeTolAreaDialog;
LABEL 99;
CONST
sy1=50;
scnw=300;
DialogType = 2;
VAR
h,scnh,n,FieldID : INTEGER;
Title : ARRAY[1..2] OF STRING;
BEGIN
Title[1]:='Tolerance Area #1';
Title[2]:='Tolerance Area #2';
scnh:=70+205*(TAreas);
AlignScr(scnw,sx1,sx2);
sy2:=sy1+scnh;
LocateButtons(DialogType,scnh,scnw);
BeginDialog(2,1,sx1,sy1,sx2,sy2);
AddButton('OK',1,1,px1,py1,px2,py2);
AddButton('Cancel',2,1,px3,py3,px4,py4);
h:=5;
FieldID:=2;
FOR n:=1 TO TAreas DO
BEGIN
FieldID:=FieldID+1;
AddField('________________________________________',FieldID,1,20,h+8,285,h+24);
FieldID:=FieldID+1;
AddField(Title[n],FieldID,1,20,h-1,155,h+15);
FieldID:=FieldID+1;
h:=h+35;
AddField('Tolerance:',FieldID,1,20,h-1,100,h+15);
FieldID:=FieldID+1;
AddField('',FieldID,2,105,h-1,170,h+15);
FieldID:=FieldID+1;
AddButton('Diameter',FieldID,3,185,h,265,h+15);
FieldID:=FieldID+1;
h:=h+30;
AddField('Material Condition:',FieldID,1,20,h-1,190,h+15);
FieldID:=FieldID+1;
h:=h+20;
AddButton('None',FieldID,3,20,h,70,h+15);
FieldID:=FieldID+1;
AddButton('Free State',FieldID,3,105,h,190,h+15);
FieldID:=FieldID+1;
AddButton('LMC',FieldID,3,220,h,270,h+15);
FieldID:=FieldID+1;
h:=h+20;
AddButton('Tangent Plane',FieldID,3,50,h,165,h+15);
FieldID:=FieldID+1;
AddButton('MMC',FieldID,3,180,h,230,h+15);
FieldID:=FieldID+1;
h:=h+30;
AddButton('Statistical Tolerance',FieldID,2,20,h,300,h+15);
FieldID:=FieldID+1;
h:=h+25;
AddButton('Projected Tolerance Zone',FieldID,2,20,h,300,h+15);
FieldID:=FieldID+1;
h:=h+25;
AddField('Max Proj Height:',FieldID,1,20,h-1,140,h+15);
FieldID:=FieldID+1;
AddField('',FieldID,2,145,h,195,h+15);
h:=h+35;
END;
99:EndDialog;
END;
BEGIN
MakeTolAreaDialog;
END;
Procedure DRefAreaDialog(DAreas : INTEGER);
{
This procedure creates the Datum Reference Area(s) dialog box.
}
Procedure MakeDRefAreaDialog;
LABEL 99;
CONST
sy1=50;
scnw=300;
DialogType = 2;
VAR
h,scnh,n,FieldID : INTEGER;
Title : ARRAY[1..3] OF STRING;
BEGIN
Title[1]:='Primary Datum Reference Area';
Title[2]:='Secondary Datum Reference Area';
Title[3]:='Tertiary Datum Reference Area';
scnh:=50+117*(DAreas);
AlignScr(scnw,sx1,sx2);
sy2:=sy1+scnh;
LocateButtons(DialogType,scnh,scnw);
BeginDialog(3,1,sx1,sy1,sx2,sy2);
AddButton('OK',1,1,px1,py1,px2,py2);
AddButton('Cancel',2,1,px3,py3,px4,py4);
h:=5;
FieldID:=2;
FOR n:=1 TO DAreas DO
BEGIN
FieldID:=FieldID+1;
AddField('________________________________________',FieldID,1,20,h+8,285,h+24);
FieldID:=FieldID+1;
AddField(Title[n],FieldID,1,20,h-1,280,h+15);
FieldID:=FieldID+1;
h:=h+35;
AddField('Datum Reference Letter(s):',FieldID,1,20,h-1,210,h+15);
FieldID:=FieldID+1;
AddField('',FieldID,2,215,h-1,280,h+15);
FieldID:=FieldID+1;
h:=h+30;
AddField('Material Condition:',FieldID,1,20,h-1,190,h+15);
FieldID:=FieldID+1;
h:=h+20;
AddButton('None',FieldID,3,20,h,70,h+15);
FieldID:=FieldID+1;
AddButton('LMC',FieldID,3,90,h,140,h+15);
FieldID:=FieldID+1;
AddButton('MMC',FieldID,3,160,h,210,h+15);
FieldID:=FieldID+1;
h:=h+35;
END;
99:EndDialog;
END;
BEGIN
MakeDRefAreaDialog;
END;
{
The following procedures display the various dialog boxes and retrieve information from them.
}
Procedure SetRButton(i,Item : INTEGER);
BEGIN
IF RFlag[i] <> Item THEN BEGIN
SetItem(RFlag[i],FALSE);
SetItem(Item,TRUE);
RFlag[i]:=Item;
END;
END;
Procedure GetGeoTolInfo;
{
This procedure displays the main dialog box.
}
VAR
Done:Boolean;
i,Item:Integer;
BEGIN
Done:=FALSE;
Abort:=FALSE;
GeoSymNum:=1;
TAreas:=1;
DAreas:=1;
BigBox:=FALSE;
RFlag[1]:=6;
RFlag[2]:=22;
RFlag[3]:=26;
GetDialog(1);
SetTitle('Geometric Tolerancing - Feature Control Frame');
SetItem(RFlag[1],TRUE);
SetItem(RFlag[2],TRUE);
SetItem(RFlag[3],TRUE);
REPEAT
DialogEvent(Item);
IF Item=1 THEN
Done:=TRUE;
IF Item=2 THEN
BEGIN
Done:=TRUE;
Abort:=TRUE;
END;
IF (Item > 6) AND (Item < 21) THEN
BEGIN
SetRButton(1,Item);
GeoSymNum:=Item-5;
END;
IF (Item = 22) OR (Item = 23) THEN
BEGIN
SetRButton(2,Item);
Tareas:=Item-21;
END;
IF (Item > 24) AND (Item < 29) THEN
BEGIN
SetRButton(3,Item);
Dareas:=Item-25;
END;
IF Item = 34 THEN
BEGIN
BigBox:=NOT BigBox;
SetItem(34,BigBox);
END;
UNTIL Done;
ClrDialog;
END;
Procedure GetTolInfo;
{
This procedure displays the tolerance info dialog box(es).
}
VAR
Done:Boolean;
Item:Integer;
BEGIN
Done:=FALSE;
Abort:=FALSE;
TMCSymNum[1]:=1;
TMCSymNum[2]:=1;
TDia[1]:=FALSE;
TDia[2]:=FALSE;
StatTol[1]:=FALSE;
StatTol[2]:=FALSE;
PTZ[1]:=FALSE;
PTZ[2]:=FALSE;
Tol[1]:=' ';
Tol[2]:=' ';
RFlag[1]:=9;
IF TAreas = 2 THEN
RFlag[2]:=24;
GetDialog(2);
SetTitle('Tolerance Areas');
SetItem(RFlag[1],TRUE);
SelField(6);
IF TAreas = 2 THEN
SetItem(RFlag[2],TRUE);
REPEAT
DialogEvent(Item);
IF Item=1 THEN
Done:=TRUE;
IF Item=2 THEN
BEGIN
Done:=TRUE;
Abort:=TRUE;
END;
IF Item = 7 THEN
BEGIN
TDia[1]:= NOT TDia[1];
SetItem(7,TDia[1]);
END;
IF (Item > 8) AND (Item < 14) THEN
BEGIN
SetRButton(1,Item);
TMCSymNum[1]:=Item-8;
END;
IF Item = 14 THEN
BEGIN
StatTol[1]:= NOT StatTol[1];
SetItem(14,StatTol[1]);
END;
IF Item = 15 THEN
BEGIN
PTZ[1]:= NOT PTZ[1];
SetItem(15,PTZ[1]);
IF PTZ[1] THEN SelField(17)
ELSE SetField(17,'');
END;
IF Item = 22 THEN
BEGIN
TDia[2]:= NOT TDia[2];
SetItem(22,TDia[2]);
END;
IF (Item > 23) AND (Item < 29) THEN
BEGIN
SetRButton(2,Item);
TMCSymNum[2]:=Item - 23;
END;
IF Item = 29 THEN
BEGIN
StatTol[2]:= NOT StatTol[2];
SetItem(29,StatTol[2]);
END;
IF Item = 30 THEN
BEGIN
PTZ[2]:= NOT PTZ[2];
SetItem(30,PTZ[2]);
IF PTZ[2] THEN SelField(32)
ELSE SetField(32,'');
END;
UNTIL Done;
Tol[1]:=GetField(6);
PTZHgt[1]:=GetField(17);
IF TAreas = 2 THEN BEGIN
Tol[2]:=GetField(21);
PTZHgt[2]:=GetField(32);
END;
ClrDialog;
END;
Procedure GetDRefInfo;
VAR
Done:Boolean;
Item:Integer;
BEGIN
Done:=FALSE;
Abort:=FALSE;
DRMCSymNum[1]:=1;
DRMCSymNum[2]:=1;
DRMCSymNum[3]:=1;
DRef[1]:=' ';
DRef[2]:=' ';
DRef[3]:=' ';
RFlag[1]:=8;
RFlag[2]:=17;
RFlag[3]:=26;
GetDialog(3);
SetTitle('Datum Reference Areas');
SetItem(8,TRUE);
IF (DAreas = 2) OR (DAreas = 3) THEN
SetItem(17,TRUE);
IF DAreas = 3 THEN
SetItem(26,TRUE);
SelField(6);
REPEAT
DialogEvent(Item);
IF Item=1 THEN
Done:=TRUE;
IF Item=2 THEN
BEGIN
Done:=TRUE;
Abort:=TRUE;
END;
IF (Item > 7) AND (Item < 11) THEN
BEGIN
SetRButton(1,Item);
DRMCSymNum[1]:=2*Item-15;
END;
IF (Item > 16) AND (Item < 20) THEN
BEGIN
SetRButton(2,Item);
DRMCSymNum[2]:=2*Item-33;
END;
IF (Item > 25) AND (Item < 29) THEN
BEGIN
SetRButton(3,Item);
DRMCSymNum[3]:=2*Item-51;
END;
UNTIL Done;
DRef[1]:=GetField(6);
IF (DAreas = 2) OR (DAreas = 3) THEN
DRef[2]:=GetField(15);
IF DAreas = 3 THEN
DRef[3]:=GetField(24);
ClrDialog;
END;
Function GetActTextSize : INTEGER;
{
This function returns the active text size.
}
VAR
a : INTEGER;
TextH : HANDLE;
BEGIN
DSelectAll;
TextOrigin(0,0);
BeginText;
' '
EndText;
TextH:=FSActLayer;
GetActTextSize:=GetSize(TextH);
DelObject(TextH);
END;
Procedure MakeGeomSymbol(SymNum : INTEGER);
{
This procedure creates the geometric tolerancing and material condition symbols used in the feature control frame.
}
VAR
A,p1,q1,r,r1 : REAL;
MatlCond : ARRAY[1..6] OF STRING;
BEGIN
{
Define material condition symbol letters.
}
MatlCond[2]:='F';
MatlCond[3]:='L';
MatlCond[4]:='T';
MatlCond[5]:='M';
MatlCond[6]:='P';
r:=0.75*h;
r1:=0.5*h;
A:=Pi/6;
Relative;
BeginGroup;
IF SymNum = 1 THEN
BEGIN
MoveTo(0.75*h, -0.433*h);
LineTo(-1.5*h, 0);
LineTo(1.5*h, 0.866*h);
END
ELSE IF SymNum = 2 THEN
BEGIN
Arc(-r,r,r,-r,0,360);
END
ELSE IF SymNum = 3 THEN
BEGIN
Arc(-r,r,r,-r,0,360);
Arc(-r1,r1,r1,-r1,0,360);
END
ELSE IF SymNum = 4 THEN
BEGIN
q1:=0.75*h - 0.5*r1;
p1:=r1*Cos(A) - q1*Tan(A);
Arc(-r1,r1,r1,-r1,0,360);
MoveTo(p1, -0.75*h);
LineTo(1.5*h*Tan(A), 1.5*h);
MoveTo(-2*r1/Cos(A), 0);
LineTo(-1.5*h*Tan(A), -1.5*h);
END
ELSE IF SymNum = 5 THEN
BEGIN
q1:=0.5*h;
p1:=0.75*h - q1*Tan(A);
MoveTo(p1, -0.5*h);
LineTo(h*Tan(A), h);
LineTo(-1.5*h, 0);
LineTo(-h*Tan(A), -h);
LineTo(1.5*h, 0)
END
ELSE IF SymNum = 6 THEN
BEGIN
q1:=0.75*h;
p1:=0.3*h - q1*Tan(A);
MoveTo(p1, -0.75*h);
LineTo(1.5*h*Tan(A), 1.5*h);
MoveTo(-0.6*h, 0);
LineTo(-1.5*h*Tan(A), -1.5*h);
END
ELSE IF SymNum = 7 THEN
BEGIN
MoveTo(-h, -0.75*h);
LineTo(2*h, 0);
MoveTo(-h, 0);
LineTo(0, 1.5*h);
END
ELSE IF SymNum = 8 THEN
BEGIN
Arc(-r1,r1,r1,-r1,0,360);
MoveTo(-0.75*h, 0);
LineTo(1.5*h, 0);
MoveTo(-0.75*h, -0.75*h);
LineTo(0, 1.5*h);
END
ELSE IF SymNum = 9 THEN
BEGIN
MoveTo(0, -h/2);
Arc(-h,h,h,-h,0,180);
END
ELSE IF SymNum = 10 THEN
BEGIN
MoveTo(0, -h/2);
Arc(-h,h,h,-h,0,180);
MoveTo(-h, 0);
LineTo(2*h, 0);
END
ELSE IF SymNum = 11 THEN
BEGIN
MoveTo(-0.75*h, -0.75*h);
LineTo(1.5*h, 1.5*h);
FillPat(2);
Poly(0,0, -0.354*h,-0.788*h, -0.424*h,0.424*h, 0.788*h,0.354*h);
END
ELSE IF SymNum = 12 THEN
BEGIN
MoveTo(-1.3*h, -0.75*h);
LineTo(1.5*h, 1.5*h);
FillPat(2);
Poly(0,0, -0.354*h,-0.788*h, -0.424*h,0.424*h, 0.788*h,0.354*h);
MoveTo(-1.5*h, -1.5*h);
LineTo(1.1*h, 0);
LineTo(1.5*h, 1.5*h);
FillPat(2);
Poly(0,0, -0.354*h,-0.788*h, -0.424*h,0.424*h, 0.788*h,0.354*h);
END
ELSE IF SymNum = 13 THEN
BEGIN
MoveTo(-h, 0);
LineTo(2*h, 0);
END
ELSE IF SymNum = 14 THEN
BEGIN
MoveTo(-h, 0);
LineTo(2*h, 0);
MoveTo(-0.4*h, 0.5*h);
LineTo(-1.2*h, 0);
MoveTo(0, -h);
LineTo(1.2*h, 0);
END
ELSE IF (SymNum >= 21) AND (SymNum <= 25) THEN
BEGIN
Arc(-r,r,r,-r,0,360);
TextOrigin(0, 0);
TextJust(2);
TextSize(0.8*TxtSize);
FillPat(0);
BeginText;
MatlCond[SymNum - 19]
EndText;
TextH:=LNewObj;
GetBBox(TextH,xb1,yb1,xb2,yb2);
HMove(TextH,0,(yb1-yb2)/2);
END ELSE IF SymNum = 26 THEN
BEGIN
OpenPoly;
BeginPoly;
LineTo(0, 0);
LineTo(0.433*h, 0.75*h);
LineTo(1.75*h, 0);
LineTo(0.433*h, -0.75*h);
LineTo(-0.433*h, -0.75*h);
LineTo(-1.75*h, 0);
LineTo(-0.433*h, 0.75*h);
EndPoly;
TextJust(2);
TextSize(0.8*TxtSize);
FillPat(0);
Move(1.25*h, 0);
TextOrigin(0,0);
BeginText;
'ST'
EndText;
TextH:=LNewObj;
GetBBox(TextH,xb1,yb1,xb2,yb2);
HMove(TextH,0,(yb1-yb2)/2);
END;
EndGroup;
FillPat(1);
TextSize(TxtSize);
END;
{
Main Program;
}
BEGIN
PushAttrs;
TextJust(2);
TextSpace(2);
FillPat(1);
{
Display main dialog box and get information
}
GeomSymDialog;
SetCursor(ArrowC);
GetGeoTolInfo;
IF Abort THEN GOTO 99;
{
Display tolerance dialog box and get tolerance information.
}
TolAreaDialog(TAreas);
GetTolInfo;
IF Abort THEN GOTO 99;
{
Display Datum Reference dialog box and get datum reference information.
}
IF DAreas=0 THEN GOTO 10;
DRefAreaDialog(DAreas);
GetDRefInfo;
IF Abort THEN GOTO 99;
10:DSelectAll;
{
Get default text size.
}
TxtSize:=GetActTextSize;
DiaChar:=Chr(175);
{
Get layer scale and units per inch.
}
LayerH:=ActLayer;
LScale:=GetLScale(LayerH);
GetUnits(UName,DA,Fmt,UPI,UM,UM2);
{
Adjust constants for layer scale, units per inch and text size.
}
h1:=UPI*LScale*TxtSize/10;
h:=h1/10;
GCSBoxLgth:=GCSBoxLgthC*h1;
GCBoxHgt:=GCBoxHgtC*h1;
CharW:=CharWC*h1;
ClearW:=ClearWC*h1;
DiaL:=DiaLC*h1;
MCW:=MCWC*h1;
STolW:=STolWC*h1;
{
Get insertion point.
}
1:GetPt(x0,y0);
{
Draw Geometric Characteristic box and insert symbol. Convert symbol to a group and adjust size for layer scale.
}
Absolute;
MoveTo(x0,y0);
Relative;
x1:=x0;
yt:=y0 - GCBoxHgt/2;
BeginGroup;
IF GeoSymNum <> 15 THEN BEGIN
BeginGroup;
IF BigBox THEN BoxHgt:=2*GCBoxHgt
ELSE BoxHgt:=GCBoxHgt;
FillPat(1);
Rect(0,0,GCSBoxLgth,-BoxHgt);
Move(GCSBoxLgth/2,-BoxHgt/2);
MakeGeomSymbol(GeoSymNum);
EndGroup;
x1:=x0+GCSBoxLgth;
END;
{
Create Tolerance box(es).
}
FOR n:=1 TO TAreas DO
BEGIN
IF Tol[n] = '' THEN GOTO 20;
{
Calculate length of Tolerance box.
}
TolL:=Len(Tol[n])*CharW;
IF TDia[n] THEN BEGIN
Tol[n]:=Concat(DiaChar,' ',Tol[n]);
TolL:=TolL+DiaL;
END;
TBoxLgth:=TolL+2*ClearW;
IF TMCSymNum[n] <> 1 THEN
TBoxLgth:=TBoxLgth + MCW + ClearW;
IF StatTol[n] THEN
TBoxLgth:=TBoxLgth + STolW + ClearW;
IF PTZ[n] THEN
BEGIN
TBoxLgth:=TBoxLgth + MCW +ClearW;
IF PTZHgt[n] <> '' THEN
BEGIN
PTZL:=Len(PTZHgt[n])*CharW;
TBoxLgth:=TBoxLgth + PTZL +ClearW;
END;
END;
{
Draw Tolerance box.
}
xt:=x1;
DSelectAll;
Absolute;
MoveTo(xt, y0);
Relative;
BeginGroup;
FillPat(1);
Rect(0,0,TBoxLgth,-GCBoxHgt);
{
Place tolerance text.
}
xt:=xt + TolL/2 + ClearW;
Absolute;
TextOrigin(xt, yt);
TextJust(2);
FillPat(0);
IF Tol[n] <> '' THEN BEGIN
BeginText;
Tol[n]
EndText;
END;
TextH:=LNewObj;
GetBBox(TextH,xb1,yb1,xb2,yb2);
HMove(TextH,0,(yb1-yb2)/2);
xt:=xt + TolL/2 + ClearW;
{
Insert material condition symbol, if needed.
}
IF TMCSymNum[n] <> 1 THEN BEGIN
xt:=xt + MCW/2;
Absolute;
MoveTo(xt, yt);
MakeGeomSymbol(TMCSymNum[n] + 19);
xt:=xt + MCW/2 + ClearW;
END;
{
Insert Statistical Tolerance symbol, if needed.
}
IF StatTol[n] THEN BEGIN
Absolute;
MoveTo(xt, yt);
MakeGeomSymbol(26);
xt:=xt + STolW + ClearW;
END;
{
Insert PTZ symbol and text, if needed.
}
IF PTZ[n] THEN BEGIN
Absolute;
xt:=xt + MCW/2;
MoveTo(xt, yt);
MakeGeomSymbol(25);
xt:=xt + MCW/2 + ClearW;
IF PTZHgt[n] <> '' THEN BEGIN
xt:=xt + PTZL/2;
Absolute;
TextOrigin(xt, yt);
FillPat(0);
BeginText;
PTZHgt[n]
EndText;
TextH:=LNewObj;
GetBBox(TextH,xb1,yb1,xb2,yb2);
HMove(TextH,0,(yb1-yb2)/2);
END;
END;
x1:=x1 + TBoxLgth;
EndGroup;
20:END;
{
Create Datum Reference box(es).
}
Absolute;
MoveTo(x1, y0);
Relative;
FOR n:=1 TO DAreas DO BEGIN
IF DRef[n] = '' THEN GOTO 80;
{
Calculate length of Datum Reference box.
}
DRefL:=Len(DRef[n])*CharW;
DRBoxLgth:=DRefL + 2*ClearW;
IF DRMCSymNum[n] <> 1 THEN
DRBoxLgth:=DRBoxLgth + MCW + ClearW;
{
Draw Datum Reference box.
}
xt:=x1;
Absolute;
MoveTo(xt, y0);
Relative;
BeginGroup;
FillPat(1);
Rect(0,0,DRBoxLgth,-GCBoxHgt);
{
Place datum reference letter(s).
}
xt:=xt + ClearW + DRefL/2;
Absolute;
TextOrigin(xt, yt);
FillPat(0);
IF DRef[n] <> '' THEN
BEGIN
BeginText;
DRef[n]
EndText;
END;
TextH:=LNewObj;
GetBBox(TextH,xb1,yb1,xb2,yb2);
HMove(TextH,0,(yb1-yb2)/2);
xt:=xt + DRefL/2 + ClearW;
{
Insert material condition symbol, if needed.
}
IF DRMCSymNum[n] <> 1 THEN BEGIN
xt:=xt + MCW/2;
Absolute;
MoveTo(xt, yt);
MakeGeomSymbol(DRMCSymNum[n] + 19);
END;
EndGroup;
x1:=x1 + DRBoxLgth;
80:END;
90:EndGroup;
PopAttrs;
99:END;
RUN(CreateFCF);