|
楼主 |
发表于 2008-3-19 09:34:22
|
显示全部楼层
回复: PR #253182 Iterative repiercing doesn't work for AF points (angle, cor
// V43B\AUTOFEAT\AFANGLEPOINTCONTACT.CPP
int CPCDAFAnglePointContact::find_nominals(CTransform & machine_to_cad)
{
CPoint3 pnt,vec,outpnt,outvec;
gp(BALLCENTER, MEAS, MACHINE, global_align, pnt);
gp(VECTOR, MEAS, MACHINE, global_align, vec);
machine_to_cad.aaforw(ROTANDTRANS,pnt,pnt);
machine_to_cad.aaforw(ROTONLY,vec,vec);
if(CPCDbasic_hit::IterateAndRePierceCadOnBestFitAlignmentsToleranceInMM == -1.0)
{
CPCDbasic_hit::IterateAndRePierceCadOnBestFitAlignmentsToleranceInMM = _ttof(CheckStringForExpression(m_pPartProgram, _T("IARPCOBFATIMM"), _T("-1.0")));
if(CPCDbasic_hit::IterateAndRePierceCadOnBestFitAlignmentsToleranceInMM == -1.0)
CPCDbasic_hit::IterateAndRePierceCadOnBestFitAlignmentsToleranceInMM = PCDGetProfileDouble(_T("Option"),_T("IterateAndRePierceCadOnBestFitAlignmentsToleranceInMM"), 20.0);
}
if(!m_pPartProgram->LISTIsEmpty(GSURF) && closest_cad_drop2(m_pPartProgram,pnt,vec,outpnt,outvec,GSURF,FALSE,FALSE,CPCDbasic_hit::IterateAndRePierceCadOnBestFitAlignmentsToleranceInMM*global_units/25.4,FALSE))
{
pp(CENTROID, THEO, CAD, global_align, outpnt);
pp(VECTOR, THEO, CAD, global_align, outvec);
pp(VECTOR, MEAS, CAD, global_align, outvec); // need to update the measured vector now that we have a better theo vector.
return CADGEOMHIT;
}
else if(!m_pPartProgram->LISTIsEmpty(GCAD) && closest_cad_drop2(m_pPartProgram,pnt,vec,outpnt,outvec,GCAD,FALSE,FALSE,CPCDbasic_hit::IterateAndRePierceCadOnBestFitAlignmentsToleranceInMM*global_units/25.4,FALSE))
{
pp(CENTROID, THEO, CAD, global_align, outpnt);
CPoint3 NVect=vec.cross(outvec);
outvec = NVect.cross(outvec);
if(outvec * vec < 0.0)
outvec*=-1.0;
pp(VECTOR, THEO, CAD, global_align, outvec);
//pp(VECTOR, MEAS, CAD, global_align, outvec);
return CADGEOMHIT;
}
else if(!m_pPartProgram->LISTIsEmpty(GSURF) || !m_pPartProgram->LISTIsEmpty(GCAD))
{
return CADGEOMFAIL;
}
return CADACCESSFAIL;
} |
|