项目使用中发现的BUG:部分ATTA出现了误报,主要还是判断的逻辑写的太复杂了以至于产生了疏漏;
BUG1:ATTA在Branch头部或者尾部时,ATTA始终报目录 树 顺序错误,原因是ATTA在Branch首尾时计算向量的起点终点方法不对,导致ATTA的目录树顺序误报错误。
BUG2:当ATTA所在的Branch直管段与XYZ三个轴斜交,不是正XYZ轴方向时,ATTA始终报目录树顺序错误,原因是校验向量因为 坐标 误差的问题导致SC向量与校验向量通过AVEVA库内置方法得不到平行的判断结果,而且应该取校验向量在Base向量上的投影向量作为实际校验向量。
Aveva.Pdms.Geometry库提供了一个 类 PointVector可以通过一个点加方向求出向量对象,从而实现向量之间的运算。
Direction currPointDir = db.GetDirection(DbAttributeInstance.ADIR);
Direction verifyVectorDir = currPointDir.Opposite(); //校验向量的方向
PointVector PSlopeVerify = PointVector.Create(db.GetPosition(DbAttributeInstance.APOS), verifyVectorDir);
char[] spara = { '(', ',', ')' };
string[] points = PSlopeVerify.ToString().Split(spara, StringSplitOptions.RemoveEmptyEntries);
/*----------------------------------------------------------------
* 这里有一个问题不明确,为什么生成PSlopeVerify向量的时候,坐标小数点后的数值自动四舍五入了
*----------------------------------------------------------------*/
D3Point D3PointVS = D3Point.Create(Double.Parse(points[0]), Double.Parse(points[1]), Double.Parse(points[2])); //起点
D3Point D3PointVE = D3Point.Create(Double.Parse(points[3]), Double.Parse(points[4]), Double.Parse(points[5])); //终点
D3Vector D3SlopeVerify = D3Vector.Create(D3PointVS, D3PointVE); //计算校验向量
D3SlopeVerify = D3SlopeVerify.ProjectOntoLine(D3SlopeBase); //计算校验向量在Base上的投影向量
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删