Смекни!
smekni.com

Технологическая реализация системы подготовки обработки детали станка с числовым программным управлением (стр. 16 из 17)

writeln(ff1,'(position_pa :part_assembly :start ','"',part_name,'" ',

':select_done :rotate :axis :',Os,' :rotation_angle ',angle:8:6,' :done ',

':pos_dynamic :dynamo-done)');

writeln(ff1,'(redraw_vp "vport1")');

end;

procedure XX(len:real);

begin

Move('x',len,'/CIP6/N_S');

end;

procedure YY(len:real);

begin

Move('y',len,'/CIP6/Krug');

end;

procedure ZZ(len:real);

begin

Move('z',len,'/CIP6/Krug');

end;

procedure AA(ang:real);

begin

writeln(ff1,'(current_wp "/CIP6/N_S/V_S/C_Sys/Det/w_A")');

Rotate('w',ang,'/CIP6/N_S/V_S/C_Sys/Det');

end;

procedure BB(ang:real);

begin

writeln(ff1,'(current_wp "/CIP6/N_S/V_S/w_B")');

Rotate('w',ang,'/CIP6/N_S/V_S');

end;

procedure CC(len:real);

begin

writeln(ff1,'(current_wp "/CIP6/N_S/V_S/w_C")');

Move('w',len,'/CIP6/N_S/V_S/C_Sys');

end;

procedure AddToFile(Fn:string;N_Pos:integer);

begin

AssignFile(ff1,Fn); //запись файла связи с 3D пакетом

Append(ff1);

Nt[N_Pos]:=F;

writeln(ff1,'(dotimes ( n ',Nt[N_Pos]:2,')');

if abs(SM_X[N_Pos])>=0.001 then

begin

XX(SM_X[N_Pos]/Nt[N_Pos]);

Xst[N_Pos]:=Xst[N_Pos-1]+SM_X[N_Pos];

end;

if abs(SM_Y[N_Pos])>=0.001 then

begin

YY(SM_Y[N_Pos]/Nt[N_Pos]);

Yst[N_Pos]:=Yst[N_Pos-1]+SM_Y[N_Pos];

end;

if abs(SM_Z[N_Pos])>=0.001 then

begin

ZZ(-SM_Z[N_Pos]/Nt[N_Pos]);

Zst[N_Pos]:=Zst[N_Pos-1]+SM_Z[N_Pos];

end;

if abs(POV_B[N_Pos])>=0.001 then

begin

BB(POV_B[N_Pos]/Nt[N_Pos]);

Bst[N_Pos]:=Bst[N_Pos-1]+POV_B[N_Pos];

end;

if abs(Pov_A[N_Pos])>=0.001 then

begin

AA(POV_A[N_Pos]/Nt[N_Pos]);

Ast[N_Pos]:=Ast[N_Pos-1]+POV_A[N_Pos];

end;

if abs(SM_C[N_Pos])>=0.001 then

begin

CC(SM_C[N_Pos]/Nt[N_Pos]);

Cst[N_Pos]:=Cst[N_Pos-1]+SM_C[N_Pos];

end;

writeln(ff1,')');

Flush(ff1);

CloseFile(ff1);

end;

procedure G90;

begin

ABS_OTN:='G90';

X:=Xst[N_Pos[N_Act]];

Y:=Yst[N_Pos[N_Act]];

Z:=Zst[N_Pos[N_Act]];

A:=Ast[N_Pos[N_Act]];

B:=Bst[N_Pos[N_Act]];

C:=Cst[N_Pos[N_Act]];

end;

procedure G91;

begin

ABS_OTN:='G91';

X:=0; Y:=0; Z:=0;

A:=0; B:=0; C:=0;

end;

procedure G01;

var

ss,ss1:string;

begin

inc(N_Pos[N_Act]);

PosTime[N_Act]:=PosTime[N_Act]+abs(FTime);

FTime:=0;

OutMet[N_Pos[N_Act]]:=Obr;

Obr:=0;

Str_Rel[N_Pos[N_Act]]:=ABS_OTN;

if pos('G91',ABS_OTN)>0 then

begin

SM_X[N_Pos[N_Act]]:=X;

SM_Y[N_Pos[N_Act]]:=Y;

SM_Z[N_Pos[N_Act]]:=Z;

POV_B[N_Pos[N_Act]]:=B;

POV_A[N_Pos[N_Act]]:=A;

SM_C[N_Pos[N_Act]]:=C;

end;

if pos('G90',ABS_OTN)>0 then

begin

SM_X[N_Pos[N_Act]]:=X-Xst[N_Pos[N_Act]-1];

SM_Y[N_Pos[N_Act]]:=Y-Yst[N_Pos[N_Act]-1];

SM_Z[N_Pos[N_Act]]:=Z-Zst[N_Pos[N_Act]-1];

POV_B[N_Pos[N_Act]]:=B-Bst[N_Pos[N_Act]-1];

POV_A[N_Pos[N_Act]]:=A-Ast[N_Pos[N_Act]-1];

SM_C[N_Pos[N_Act]]:=C-Cst[N_Pos[N_Act]-1];

end;

Xst[N_Pos[N_Act]]:=Xst[N_Pos[N_Act]-1];

Yst[N_Pos[N_Act]]:=Yst[N_Pos[N_Act]-1];

Zst[N_Pos[N_Act]]:=Zst[N_Pos[N_Act]-1];

Ast[N_Pos[N_Act]]:=Ast[N_Pos[N_Act]-1];

Bst[N_Pos[N_Act]]:=Bst[N_Pos[N_Act]-1];

Cst[N_Pos[N_Act]]:=Cst[N_Pos[N_Act]-1];

str(N_Pos[N_Act]:1,ss);

if NC_ACt=0 then

begin

str(N_Pos[N_Act]:1,ss1);

Form1.CheckListBox1.Items.Add(ss+':'+Com[N_Pos[N_Act]]);

if N_Pos[N_Act]>1 then

Form1.CheckListBox1.State[N_Pos[N_Act]-1]:=cbUnChecked;

Form1.CheckListBox1.State[N_Pos[N_Act]]:=cbChecked;

AddToFile(Path+'LSP\Hod.lsp',N_Pos[N_Act]);

end;

end;

procedure Profile;

var

RF:real;

ff:textfile;

X3,Y3,Z3,X31,Y31,Z31,X32,Y32,Z32,Mu_YZ,Mu_YZ1,Mu_YX,Mu_XZ:real;

Xin,Yin,Zin,Xex,Yex,Zex,Muin,Muex:real;

Xin1,Yin1,Zin1,Xex1,Yex1,Zex1,Muin1,Muex1:real;

Ang,Rs,Rd,Ksi,Ksi1,Xc,Yc,Zc1,Xc1,Yc1,F0,F1,Ficx:real;

N_Uch,N_Point,Np1,i,j,N_Half:integer;

dTeta,R_Limit1,R_Limit2,xL1,yL1,zL1,xL2,yL2,zL2,xL3,yL3,zL3,

fex,Alf1,Alf2,Alf3,L1,L2,L3,Step:real;

xL1f,yL1f,zL1f,xL2f,yL2f,zL2f,xL3f,yL3f,zL3f:real;

N_Break:array [1..2,0..4,0..100] of integer;

N_SpL:integer;

//LtrR,LtrP:extended;

fiA{,fiAmax},Vfi,fit_max,dX,dY,dZ:real;

Xv03,Yv03,Zv03:real;

K_Razb:real;

Fex_Min,Fex_Max:array [1..3] of real;

fit0,{fit_st,fit_fin,}dS_Min:real;

Empt:array [1..12] of integer;

a1_p,an_p,Sn_p,r_p,Ltr_Pfin:real;

NSect:integer;

procedure Sil(N_Tr:integer);

var

i:integer;

ff1:textfile;

fixX,fixY,fixZ:real;

fixX1,fixY1,fixZ1:real;

fixX2,fixY2,fixZ2:real;

procedure Vint(N_Tr,N_Half,N_Uch,j:integer);

begin

XvT[N_Tr,N_Half,N_Uch,j]:=Xv[N_Tr,N_Half,N_Uch,j];

YvT[N_Tr,N_Half,N_Uch,j]:=Yv[N_Tr,N_Half,N_Uch,j]*cos({FiA}0)+

Zv[N_Tr,N_Half,N_Uch,j]*sin({FiA}0);

ZvT[N_Tr,N_Half,N_Uch,j]:=-Yv[N_Tr,N_Half,N_Uch,j]*sin({FiA}0)+

Zv[N_Tr,N_Half,N_Uch,j]*cos({FiA}0);

fixX:=XvT[N_Tr,N_Half,N_Uch,j];

fixY:=YvT[N_Tr,N_Half,N_Uch,j];

fixZ:=ZvT[N_Tr,N_Half,N_Uch,j];

writeln(ff1,XvT[N_Tr,N_Half,N_Uch,j]:8:5,',',

YvT[N_Tr,N_Half,N_Uch,j]:1:5,',',

ZvT[N_Tr,N_Half,N_Uch,j]:1:5);

end;

procedure Create_Bspline(N_Tr,N_Sp,N_Uch,N_Half:integer);

var

j:integer;

x3,y3,z3:real;

begin

inc(N_Spl);

case N_Sp of

begin

writeln(ff1,'(create_curve_on_surface :wire_part "/Sil_',N_Tr:1,'.',N_Spl:1,'" ',

':start :selected_part "/a1/Krug" :face_3d :by_feature ',

':full_name :start_name "/a1/Krug" :feature "feat1" ',

':end_name :select_done ');

for j:=0 to N_Razb[N_Act] do

if (N_Break[N_Half,N_Uch,j]=0) then

begin

Empt[N_Sp]:=1;

Vint(N_Tr,N_Half,N_Uch,j);

if (N_Spl=4) and (j=N_Razb[N_Act]) then

Vint(N_Tr,1,1,j);

if (N_Spl=6) and (j=N_Razb[N_Act]) then

Vint(N_Tr,1,3,j);

end;

writeln(ff1,')');

writeln(ff1,'(remove_from_vp_drawlist "vport1" :with-wp ',

' "/Sil_',N_Tr:1,'.',N_Spl:1,'")');

end;

begin

{ Vint(N_Tr,1,1,N_Razb[N_Act]);

fixX1:=fixX; fixY1:=fixY; fixZ1:=fixZ;

Vint(N_Tr,1,3,N_Razb[N_Act]);

fixX2:=fixX; fixY2:=fixY; fixZ2:=fixZ;

x3:=(fixX1+fixX2)/2;

z3:=(fixZ1+fixZ2)/2;

y3:=(fixY1+fixY2)/2+Ddet;

writeln(ff1,'(create_bspline :wire_part "/Sil_',N_Tr:1,'.',N_Spl:1,'" ',

':input_mode :control ');

Vint(N_Tr,1,1,N_Razb[N_Act]);

writeln(ff1,x3:8:8,',',y3:1:8,',',z3:1:8);

Vint(N_Tr,1,3,N_Razb[N_Act]);}

writeln(ff1,'(create_bspline :wire_part "/Sil_',N_Tr:1,'.',N_Spl:1,'" ',

':start_condition :edge :cv_edge ',

':start :selected_part "/Sil_',N_Tr:1,'.',1:1,'" :edge_3d :by_vertex_3d');

Empt[N_Sp]:=1;

Vint(N_Tr,1,1,N_Razb[N_Act]);

writeln(ff1,':select_done ');

Vint(N_Tr,1,1,N_Razb[N_Act]);

writeln(ff1,':tangent 0.2 :accept ',

':end_condition :edge :cv_edge ',

':start :selected_part "/Sil_',N_Tr:1,'.',3:1,'" :edge_3d :by_vertex_3d');

Vint(N_Tr,1,3,N_Razb[N_Act]);

writeln(ff1,':select_done ');

Vint(N_Tr,1,3,N_Razb[N_Act]);

writeln(ff1,':tangent 0.2 :accept ');

writeln(ff1,')');

writeln(ff1,'(remove_from_vp_drawlist "vport1" :with-wp ',

' "/Sil_',N_Tr:1,'.',N_Spl:1,'")');

end;

begin

writeln(ff1,'(create_bspline :wire_part "/Sil_',N_Tr:1,'.',N_Spl:1,'" ',

':start_condition :edge :cv_edge ',

':start :selected_part "/Sil_',N_Tr:1,'.',5:1,'" :edge_3d :by_vertex_3d ');

Empt[N_Sp]:=1;

Vint(N_Tr,2,1,N_Razb[N_Act]);

fixX1:=fixX; fixY1:=fixY; fixZ1:=fixZ;

writeln(ff1,':select_done ');

Vint(N_Tr,2,1,N_Razb[N_Act]);

writeln(ff1,':accept ',

':end_condition :edge :cv_edge ',

':start :selected_part "/Sil_',N_Tr:1,'.',7:1,'" :edge_3d :by_vertex_3d ');

Vint(N_Tr,2,3,N_Razb[N_Act]);

fixX2:=fixX; fixY2:=fixY; fixZ2:=fixZ;

writeln(ff1,':select_done ');

Vint(N_Tr,2,3,N_Razb[N_Act]);

writeln(ff1,':accept )');

writeln(ff1,'(modify_bspline :curve :start :selected_part "/Sil_',N_Tr:1,'.8" ',

':all_3d :select_done ',

':insert_point ',fixX1:8:5,',',

fixY1:1:5,',',

fixZ1:1:5,' ',

(fixX1+fixX2)/2:8:5,',',

(fixY1+fixY2)/2:1:5,',',

(fixZ1+fixZ2)/2:1:5,' ');

writeln(ff1,')');

end;

end;

end;

begin

for i:=1 to 10 do

Empt[i]:=0;

AssignFile(ff1,Path+'LSP\Sil.lsp');

Append(ff1);

N_Spl:=0;

writeln(ff1,'(position_pa :part_assembly :start "/a1/Krug" :select_done ',

':translate :x ',dX:8:5,')');

writeln(ff1,'(position_pa :part_assembly :start "/a1/Krug" :select_done ',

':translate :y ',dY:8:5,')');

writeln(ff1,'(position_pa :part_assembly :start "/a1/Krug" :select_done ',

':translate :z ',dZ:8:5,')');

{ if N_Tr=N_Sech[N_Act] then

writeln(ff1,'(position_pa :part_assembly :start "/a1/Krug.1" :select_done ',

':rotate :axis :x :rotation_angle ',-fiA/pi*180:8:5,' :done :translate :x ',

-dX:8:5,')');

}

{ if N_Tr=N_Sech[N_Act] then

begin

writeln(ff1,'(create_multiple_pa :copy :source "/a1/surf1" :owner "/" )');

writeln(ff1,'(create_multiple_pa :copy :source "/a1/surf2" :owner "/" )');

writeln(ff1,'(create_multiple_pa :copy :source "/a1/surf3" :owner "/" )');

end; }

Create_Bspline(N_Tr,1,1,1);

Create_Bspline(N_Tr,2,2,1);

Create_Bspline(N_Tr,3,3,1);

Create_Bspline(N_Tr,4,1,3);

for i:=1 to N_Spl do

writeln(ff1,'(position_pa :part_assembly :start "/Sil_',N_Tr:1,'.',i:1,'" ',

':select_done ',

':rotate :axis :x :rotation_angle ',(fiAmax-fiA)/pi*180:8:5,')');

if N_Tr<N_Sech[N_Act] then

begin

// writeln(ff1,'(position_pa :part_assembly :start "/a1/Krug" :select_done ',

// ':rotate :axis :x :rotation_angle ',fiA/pi*180:8:5,')');

writeln(ff1,'(position_pa :part_assembly :start "/a1/Krug" :select_done ',

':translate :x ',-dX:8:5,')');

writeln(ff1,'(position_pa :part_assembly :start "/a1/Krug" :select_done ',

':translate :y ',-dY:8:5,')');

writeln(ff1,'(position_pa :part_assembly :start "/a1/Krug" :select_done ',

':translate :z ',-dZ:8:5,')');

end;

//W_Str1('N_spl='+w_i(N_Spl,1));

Flush(ff1);

CloseFile(ff1);

end;


Приложение Б

Параметры проекта Delphi:

-$A8

-$B-

-$C+

-$D+

-$E-

-$F-

-$G+

-$H+

-$I+

-$J-

-$K-

-$L+

-$M-

-$N+

-$O+

-$P+

-$Q-

-$R-

-$S-

-$T-

-$U-

-$V+

-$W-

-$X+

-$YD

-$Z1

-cg

-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;

-H+

-W+

-M

-$M16384,1048576

-K$00400000

-LE"c:&bsol;program files&bsol;borland&bsol;delphi7&bsol;Projects&bsol;Bpl"

-LN"c:&bsol;program files&bsol;borland&bsol;delphi7&bsol;Projects&bsol;Bpl"

-w-UNSAFE_TYPE

-w-UNSAFE_CODE

-w-UNSAFE_CAST

[FileVersion]

Version=7.0 //версияфайла

[Compiler]

A=8 //начальные параметры

B=0

C=1

D=1

E=0

F=0

G=1

H=1

I=1

J=0

K=0

L=1

M=0

N=1

O=1

P=1

Q=1

R=1

S=0

T=0

U=0

V=1

W=1

X=1

Y=1

Z=1

ShowHints=1

ShowWarnings=1

UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;

NamespacePrefix=

SymbolDeprecated=1

SymbolLibrary=1

SymbolPlatform=1

UnitLibrary=1

UnitPlatform=1

UnitDeprecated=1

HResultCompat=1

HidingMember=1

HiddenVirtual=1

Garbage=1

BoundsError=1

ZeroNilCompat=1

StringConstTruncated=1

ForLoopVarVarPar=1

TypedConstVarPar=1

AsgToTypedConst=1

CaseLabelRange=1

ForVariable=1

ConstructingAbstract=1

ComparisonFalse=1

ComparisonTrue=1

ComparingSignedUnsigned=1

CombiningSignedUnsigned=1

UnsupportedConstruct=1

FileOpen=1

FileOpenUnitSrc=1

BadGlobalSymbol=1

DuplicateConstructorDestructor=1

InvalidDirective=1

PackageNoLink=1

PackageThreadVar=1

ImplicitImport=1

HPPEMITIgnored=1

NoRetVal=1

UseBeforeDef=1

ForLoopVarUndef=1

UnitNameMismatch=1

NoCFGFileFound=1

MessageDirective=1

ImplicitVariants=1

UnicodeToLocale=1

LocaleToUnicode=1

ImagebaseMultiple=1

SuspiciousTypecast=1

PrivatePropAccessor=1

UnsafeType=1

UnsafeCode=1

UnsafeCast=1

[Linker]

MapFile=0

OutputObjs=0

ConsoleApp=1

DebugInfo=0

RemoteSymbols=0

MinStackSize=16384

MaxStackSize=1048576

ImageBase=4194304

ExeDescription=

[Directories] //параметрыпроекта

OutputDir=

UnitOutputDir=

PackageDLLOutputDir=

PackageDCPOutputDir=

SearchPath=

Packages=vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;inetdb;inet;nmfast;vclie;dbexpress;dbxcds;indy;dclOffice2k

Conditionals=

DebugSourceDirs=

UsePackages=0

[Parameters]

RunParams=

HostApplication=

Launcher=

UseLauncher=0

DebugCWD=

[Language]

ActiveLang=

ProjectLang=

RootDir=

[Version Info]

IncludeVerInfo=0

AutoIncBuild=0

MajorVer=1

MinorVer=0

Release=0

Build=0

Debug=0

PreRelease=0

Special=0

Private=0

DLL=0

Locale=1049

CodePage=1251

[Version Info Keys] //информацияопроекте

CompanyName=

FileDescription=

FileVersion=1.0.0.0

InternalName=

LegalCopyright=

LegalTrademarks=

OriginalFilename=

ProductName=

ProductVersion=1.0.0.0

Comments=

[HistoryLists&bsol;hlUnitAliases]

Count=1

Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;


Приложение B

Текст настроечного файла программного модуля:

3

2

5.260 5.000 105.000 1.000 1.250

0.700 0.900 7.410 0.350 120.000

10.000 25.000 0.900 30.000 0.200

85.000 1.300 50.000 71.000 0.060 3

3

99.86600 9.70600 90.00000

0.45000 0.20000 50.78000

-58.71300 53.29000 -196.78000 -180.36000

125.06600 4.05600 90.00000

1.95000 1.95000 50.73000

-71.26300 65.89000 -147.21000 -136.44000

100.16600 9.97300 90.00000

0.10000 1.10000 50.69000

-58.77300 53.44000 -105.12700 -88.44000

130.00000 88.00000 6.71400

6

Канавка

0.000 0.00000 40.00000 53.50000 1 1 0.00000 0.71966 0.85300 -0.2000 99999999.000 0 2.000 2 0.000 0 1 1 1 1 20 0.0100 1

0.000 0.000 0.000 0.000 0.000 0.000

Затылок

0.000 -0.01719 40.00000 47.00000 1 1 0.00000 5.14988 -4.85300 -1.0000 999999.000 0 1.000 2 0.000 0 1 1 1 1 20 0.0100 1

0.000 0.000 0.000 421.303 0.000 0.000

1 задний угол

58.525 0.00000 80.00000 80.00000 3 2 0.25000 -30.00000 0.00000 0.5000 999999.000 0 2.000 2 0.000 0 1 1 1 1 20 0.0100 1

0.000 0.000 0.000 -70.110 0.000 0.000