コード例 #1
0
        public short InitCrd(short cardId, short csId, double velMax, double accMax, short evenTime, short axisX, short axisY, short axisA, int orgX, int orgY, int orgA, int cardType)
        {
            mc.TCrdPrm crdPrm = new mc.TCrdPrm();
            crdPrm.dimension = 3;
            crdPrm.synVelMax = velMax;
            crdPrm.synAccMax = accMax;
            crdPrm.evenTime  = evenTime;

            if (cardType == 0)//单8轴
            {
                crdPrm.profile1      = 1;
                crdPrm.profile2      = 2;
                crdPrm.profile4      = 3;
                crdPrm.setOriginFlag = 1;
                crdPrm.originPos1    = orgX;
                crdPrm.originPos2    = orgY;
                crdPrm.originPos4    = orgA;
            }

            short rtn = mc.GT_SetCrdPrm(cardId, csId, ref crdPrm);

            if (rtn != 0)
            {
                return(rtn);
            }
            return(0);
        }
コード例 #2
0
        /// <summary>
        ///     设置插补坐标系
        /// </summary>
        /// <param name="nCardNum"></param>
        /// <param name="nDim">坐标系维数</param>
        /// <param name="synVelMax">坐标系的最大合成速度</param>
        /// <param name="synAccMax">坐标系的最大合成加速度</param>
        /// <param name="evenTime">坐标系的最小匀速时间</param>
        /// <param name="profile">规划器对应的轴</param>
        /// <returns></returns>
        public override short SetLineOrdi(short nCardNum, short nDim, double synVelMax, double synAccMax,
                                          short evenTime, short[] profile)
        {
            short nRtn   = 0;
            var   crdPrm = new mc.TCrdPrm();

            crdPrm.dimension = nDim;      // 建立二/三/四维的坐标系
            crdPrm.synVelMax = synVelMax; // 坐标系的最大合成速度是: 500 pulse/ms
            crdPrm.synAccMax = synAccMax; // 坐标系的最大合成加速度是: 2 pulse/ms^2
            crdPrm.evenTime  = evenTime;  // 坐标系的最小匀速时间为0

            crdPrm.profile1 = profile[0];
            crdPrm.profile2 = profile[1];
            crdPrm.profile3 = profile[2];
            crdPrm.profile4 = profile[3];
            crdPrm.profile5 = profile[4];
            crdPrm.profile6 = profile[5];
            crdPrm.profile7 = profile[6];
            crdPrm.profile8 = profile[7];

            crdPrm.setOriginFlag = 1; // 需要设置加工坐标系原点位置
            crdPrm.originPos1    = 0; // 加工坐标系原点位置在(0,0),即与机床坐标系原点重合
            crdPrm.originPos2    = 0;
            crdPrm.originPos3    = 0;
            crdPrm.originPos4    = 0;
            crdPrm.originPos5    = 0;
            crdPrm.originPos6    = 0;
            crdPrm.originPos7    = 0;
            crdPrm.originPos8    = 0;

            nRtn |= mc.GT_SetCrdPrm(nCardNum, 1, ref crdPrm);
            return(nRtn);
        }
コード例 #3
0
        public short InitCrd(short cardId, short csId, double velMax, double accMax, short evenTime, short axisX, short axisY, short axisA, short axisB, int orgX, int orgY, int orgA, int orgB, int cardType)
        {
            mc.TCrdPrm crdPrm = new mc.TCrdPrm();
            crdPrm.dimension = 4;
            crdPrm.synVelMax = velMax;
            crdPrm.synAccMax = accMax;
            crdPrm.evenTime  = evenTime;
            if (cardType == 0)//单8轴
            {
                crdPrm.profile1      = 1;
                crdPrm.profile2      = 2;
                crdPrm.profile5      = 3;
                crdPrm.profile6      = 4;
                crdPrm.setOriginFlag = 1;
                crdPrm.originPos1    = orgX;
                crdPrm.originPos2    = orgY;
                crdPrm.originPos5    = orgA;
                crdPrm.originPos6    = orgB;
            }
            else//双4轴
            {
                if (axisX == 5 && axisY == 6)
                {
                    crdPrm.profile1      = 5;
                    crdPrm.profile2      = 6;
                    crdPrm.profile3      = 7;
                    crdPrm.profile4      = 8;
                    crdPrm.setOriginFlag = 1;
                    crdPrm.originPos1    = orgX;
                    crdPrm.originPos2    = orgY;
                    crdPrm.originPos5    = orgA;
                    crdPrm.originPos6    = orgB;
                }
                else
                {
                    crdPrm.profile1      = 1;
                    crdPrm.profile2      = 2;
                    crdPrm.profile3      = 3;
                    crdPrm.profile4      = 4;
                    crdPrm.setOriginFlag = 1;
                    crdPrm.originPos1    = orgX;
                    crdPrm.originPos2    = orgY;
                    crdPrm.originPos3    = orgA;
                    crdPrm.originPos4    = orgB;
                }
            }
            short rtn = mc.GT_SetCrdPrm(cardId, csId, ref crdPrm);

            if (rtn != 0)
            {
                return(rtn);
            }
            return(0);
        }
コード例 #4
0
        public short InitCrd(short cardId, short csId, double velMax, double accMax, short evenTime, short axisX, short axisY, int orgX, int orgY)
        {
            mc.TCrdPrm crdPrm = new mc.TCrdPrm();
            //crdPrm.dimension = 2;
            crdPrm.synVelMax   = velMax;
            crdPrm.synAccMax   = accMax;
            crdPrm.axis1       = axisX;
            crdPrm.axis2       = axisY;
            crdPrm.axis3       = mc.RES_NONE;
            crdPrm.axis4       = mc.RES_NONE;
            crdPrm.axis5       = mc.RES_NONE;
            crdPrm.originPos1  = orgX;
            crdPrm.originPos2  = orgY;
            crdPrm.originPos3  = 0;
            crdPrm.originPos4  = 0;
            crdPrm.originPos5  = 0;
            crdPrm.axisVelMax1 = velMax;
            crdPrm.axisVelMax2 = velMax;
            //crdPrm.axisVelMax1 = 0;
            //crdPrm.axisVelMax2 = 0;
            //crdPrm.axisVelMax1 = 0;
            crdPrm.decSmoothStop = 5;
            crdPrm.decAbruptStop = 10;
            //crdPrm.evenTime = evenTime;
            //if (axisX == 5 && axisY == 6)
            //{
            //    crdPrm.profile5 = 1;
            //    crdPrm.profile6 = 2;
            //    crdPrm.originPos5 = orgX;
            //    crdPrm.originPos6 = orgY;
            //}
            //else if (axisX == 3 && axisY == 4)  //小8字机台AB轴插补
            //{
            //    crdPrm.profile3 = 1;
            //    crdPrm.profile4 = 2;
            //    crdPrm.originPos3 = orgX;
            //    crdPrm.originPos4 = orgY;
            //}
            //else
            //{
            //    crdPrm.profile1 = axisX;
            //    crdPrm.profile2 = axisY;
            //    crdPrm.originPos1 = orgX;
            //    crdPrm.originPos2 = orgY;
            //}
            crdPrm.setOriginFlag = 1;
            short rtn = mc.API_SetCrdPrm(csId, ref crdPrm, cardId);

            if (rtn != 0)
            {
                return(rtn);
            }
            return(0);
        }
コード例 #5
0
        public short InitCrd(short cardId, short csId, double velMax, double accMax, short evenTime, short axisX, short axisY, int orgX, int orgY)
        {
            mc.TCrdPrm crdPrm = new mc.TCrdPrm();
            crdPrm.dimension = 2;
            crdPrm.synVelMax = velMax;
            crdPrm.synAccMax = accMax;
            crdPrm.evenTime  = evenTime;
            if (axisX == 5 && axisY == 6)
            {
                crdPrm.profile5   = 1;
                crdPrm.profile6   = 2;
                crdPrm.originPos5 = orgX;
                crdPrm.originPos6 = orgY;
            }
            else if (axisX == 3 && axisY == 4)  //小8字机台AB轴插补
            {
                crdPrm.profile3   = 1;
                crdPrm.profile4   = 2;
                crdPrm.originPos3 = orgX;
                crdPrm.originPos4 = orgY;
            }
            else
            {
                crdPrm.profile1   = axisX;
                crdPrm.profile2   = axisY;
                crdPrm.originPos1 = orgX;
                crdPrm.originPos2 = orgY;
            }
            crdPrm.setOriginFlag = 1;
            short rtn = mc.GT_SetCrdPrm(cardId, csId, ref crdPrm);

            if (rtn != 0)
            {
                return(rtn);
            }
            return(0);
        }