close tables all >use 'i:\data\ecnc\data\punchheader.dbf' in 1 shared >use 'i:\data\ecnc\data\dwgdata.dbf' in 2 shared >use 'i:\data\ecnc\data\punchparams.dbf' in 3 shared >set deleted on >set exact on > >* search punchheader.dbf and add jobnum, numofparts and drawingnum to punchparams.dbf >* if it doesn't exist, if numofparts>1, if length of jobnum>0 >local lcJob, lnParts, llFound, lnDwgNum >select 1 >scan > lcJob=alltrim(punchheader.jobnum) > lnParts=(punchheader.numofparts) > lnDwgNum=val(alltrim(punchheader.drawingnum)) > select 3 > go top > llFound=(.F.) > scan for (alltrim(punchparams.jobnum))=(lcJob) > llFound=(.T.) > endscan > if llFound=(.F.) and (lnParts)>=1 and len(lcJob)>0 > append blank > replace punchparams.jobnum with (lcJob) > replace punchparams.numofparts with (lnParts) > replace punchparams.drawingnum with (lnDwgNum) > ** set the head concentricity to 0.003 by default doesnt get updated by the drawing yet > replace punchparams.hc WITH 0.0030 > endif >endscan > >* replace all drawing info in params with that from dwgdata.dbf >* if drawing exists in params >set exact on >set deleted on >select 2 >go top >scan > scatter memvar > m.drawingnum=val(alltrim(dwgdata.drawingnum)) > m.ol=m.pol > m.olplus=m.polplus > m.olminus=m.polminus > IF m.HC<=0 > m.HC=0.0030 > endif > select 3 > go top > scan for (punchparams.drawingnum)=(m.drawingnum) > gather memvar > endscan >endscan > >* replace heat treat and hardness in punchheader.dbf from dwgdata.dbf >select 2 >go top >scan > scatter memvar > select 1 > go top > scan for (punchheader.drawingnum)=(m.drawingnum) > replace punchheader.hardness with m.ht > replace punchheader.steel with m.steel > endscan >endscan > >close tables >*clear memory >* now follow the same procedures for the dies >use 'i:\data\ecnc\data\dieheader.dbf' in 1 shared >use 'i:\data\ecnc\data\dwgdata.dbf' in 2 shared >use 'i:\data\ecnc\DATA\dieparams.dbf' in 3 shared >set deleted on >set exact on > >* search dieheader.dbf and add jobnum, numofparts and drawingnum to dieparams.dbf >* if it doesn't exist, if numofparts>1, if length of jobnum>0 >local lcJob, lnParts, llFound, lnDwgNum >select 1 >scan > lcJob=alltrim(dieheader.jobnum) > lnParts=(dieheader.numofparts) > lnDwgNum=val(alltrim(dieheader.drawingnum)) > select 3 > go top > llFound=(.F.) > scan for (alltrim(dieparams.jobnum))=(lcJob) > llFound=(.T.) > endscan > if llFound=(.F.) and (lnParts)>=1 and len(lcJob)>0 > append blank > replace dieparams.jobnum with (lcJob) > replace dieparams.numofparts with (lnParts) > replace dieparams.drawingnum with (lnDwgNum) > **use 0.001 squareness as a default value for all new records. > replace dieparams.square WITH 0.0010 > endif >endscan > >* replace all drawing info in dieparams with that from dwgdata.dbf >* if drawing exists in dieparams >select 2 >go top >scan > scatter memvar > m.drawingnum=val(alltrim(dwgdata.drawingnum)) > m.ol=m.dol > m.olplus=m.dolplus > m.olminus=m.dolminus > select 3 > go top > scan for (dieparams.drawingnum)=(m.drawingnum) > gather memvar > endscan >endscan > >* replace heat treat and hardness in dieheader.dbf from dwgdata.dbf >select 2 >go top >scan > scatter memvar > select 1 > go top > scan for (dieheader.drawingnum)=(m.drawingnum) > replace dieheader.hardness with m.ht > replace dieheader.steel with m.steel > endscan >endscan >