DMIS标准中向量变量的用法如下,数据结果可以参考图片中结果,使用RationalDMIS软件来演示;VCART()函数的是将坐标系三个方向取为矢量变量DECL/COMMON,VECTOR,ORG_CIR1_VXKNPTR1 = OBTAIN/D(ORG_CIR1),5KNPTR2 = OBTAIN/D(ORG_CIR1),6KNPTR3 = OBTAIN/D(ORG_CIR1),7ORG_CIR1_VX = ASSIGN/VCART(KNPTR1,KNPTR2,KNPTR3)DECL/COMMON,VECTOR,ORG_CIR1_VYKNPTR1 = OBTAIN/D(ORG_CIR1),8KNPTR2 = OBTAIN/D(ORG_CIR1),9KNPTR3 = OBTAIN/D(ORG_CIR1),10ORG_CIR1_VY = ASSIGN/VCART(KNPTR1,KNPTR2,KNPTR3)DECL/COMMON,VECTOR,ORG_CIR1_VZKNPTR1 = OBTAIN/D(ORG_CIR1),11KNPTR2 = OBTAIN/D(ORG_CIR1),12KNPTR3 = OBTAIN/D(ORG_CIR1),13ORG_CIR1_VZ = ASSIGN/VCART(KNPTR1,KNPTR2,KNPTR3)VECX(),VECY(),VECZ()函数分别为取矢量变量的3个分量;DECL/VECTOR,pntpnt=ASSIGN/VCART(8,9,10)DECL/DOUBLE,GOTOX,GOTOY,GOTOZGOTOX = ASSIGN/ VECX(pnt)GOTOY = ASSIGN/ VECY(pnt)GOTOZ = ASSIGN/ VECZ(pnt)GOTO/GOTOX,GOTOY,GOTOZVDOT(v1,v2)是求2个向量的点积,结果为实数向量点积就是各分量分别相乘相加,如下就是1*0+1*1+1*1=2VCROSS(v1,v2)是求叉积,结果是向量向量叉积计算公式如下:$$ 设a=(X1,Y1,Z1),b=(X2,Y2,Z2) a×b=(Y1Z2-Y2Z1,Z1X2-Z2X1,X1Y2-X2Y1)DECL/DOUBLE,VictorDotDECL/VECTOR,XA,YAXA = ASSIGN/ VCART(1,1,1)YA = ASSIGN/ VCART(0,1,1)VictorDot = ASSIGN/ VDOT(XA,YA)DECL/VECTOR,VictorCrossVictorCross = ASSIGN/ VCROSS(XA,YA)VUNIT()功能是将矢量变量单位化DECL/Vector,VictorUnitVictorUnit = ASSIGN/ VUNIT(pnt)VMAG()是计算向量的长度 计算方法就是各分量平方相加再开根号DECL/DOUBLE,VictorMagnitudeVictorMagnitude = ASSIGN/ VMAG(pnt)VMCS()将向量从当前坐标系转为了MCS下DECL/VECTOR, VictorMCSVictorMCS = ASSIGN/ VMCS(pnt)VPCS()将向量从MCS转换为当前坐标系下DECL/VECTOR, VictorPCSVictorPCS = ASSIGN/ VPCS(VictorMCS)VPOL()将各方向的长度作为一个向量;DECL/VECTOR,VictorPOLVictorPOL = ASSIGN/ VPOL(10,90*3.141592/180,5)--------------------- 版权声明:本文为傅海鑫原创文章 来源:山涧果子