示例#1
0
        /// <summary>
        /// 清空机器人Home预制坐标信息_Yecc
        /// </summary>
        /// <param name="FM"></param>
        /// <param name="DSystem"></param>
        /// <param name="product"></param>
        /// <param name="RobotName"></param>
        /// <param name="progressBar"></param>
        /// <param name="CreateCable"></param>
        public void ClearRobotHomeList(Form FM, DataType.Dsystem DSystem, Product product, String RobotName, ProgressBar progressBar, bool CreateCable = false)
        {
            //Workbench TheKinWorkbench = DSystem.CDSActiveDocument.GetWorkbench("KinematicsWorkbench");
            Mechanisms      cTheMechanisms = null;
            ProductDocument partDocument   = GetProductPath(product, DSystem, false);
            Selection       selection      = partDocument.Selection;

            selection.Clear();
            try
            {
                BasicDevice  basicDevice   = (BasicDevice)product.GetTechnologicalObject("BasicDevice");
                System.Array homePositions = null;
                //for (int i = 0; i < 100; i++) // add New Robot Home Position
                //{
                //    object[] HomePos = { 0, 0, 0, 0, 0, 0 };
                //    basicDevice.SetHomePosition("RobotHome_" + i, HomePos);
                //}
                basicDevice.GetHomePositions(out homePositions);
                int HomePosNum = homePositions.Length;
                if (HomePosNum > 1) //当对象运动机构数量>1时 清除全部机构对象
                {
                    foreach (HomePosition homePosition in homePositions)
                    {
                        selection.Add(homePosition);
                        //Array AtoolTip = null;
                        //homePosition.GetAssociatedToolTip(out AtoolTip);
                        //selection.Add(homePosition);
                    }
                    selection.Delete();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + ";请在帮助-》问题反馈与建议中反馈该问题,谢谢!");
                //选定的对象不存在任何运动机构
            }
            //Mechanisms TheMechanismsList = TheKinWorkbench.Mechanisms;
            RobGenericController Rgcr          = (RobGenericController)product.GetTechnologicalObject("RobGenericController");
            RobControllerFactory CRM           = (RobControllerFactory)product.GetTechnologicalObject("RobControllerFactory");
            GenericMotionProfile genericMotion = null;
            int ProfileCount = 0;

            Rgcr.GetMotionProfileCount(out ProfileCount);
            if (ProfileCount > 0)
            {
                string ProfileName = "DNBRobController";
                Rgcr.GetMotionProfile(ProfileName, out genericMotion);
            }
            InitController(Rgcr, CRM, 10, progressBar);
            Mechanism mechanism = cTheMechanisms.Add();
            //mechanism.FixedPart=
            ///RefDocument//mk:@MSITStore:F:\02%20我的知识库\05%20学习&总结资料\01%20CAA开发资料\V5Automation.chm::/online/CAAScdDmuUseCases/CAAKiiMechanismCreationSource.htm
            //string GetName = CRM.get_Name();
        }
示例#2
0
        public void CreateRobotMoto(Form FM, DataType.Dsystem DSystem, Product product, String RobotName, ProgressBar progressBar, bool CreateCable = false)
        {
            Workbench  TheKinWorkbench = DSystem.CDSActiveDocument.GetWorkbench("KinematicsWorkbench");
            Mechanisms cTheMechanisms  = null;

            try
            {
                cTheMechanisms = (Mechanisms)product.GetTechnologicalObject("Mechanisms");
                if (cTheMechanisms.Count > 1) //当对象运动机构数量>1时 清除全部机构对象
                {
                    foreach (Mechanism item in cTheMechanisms)
                    {
                        cTheMechanisms.Remove(item); //Clear All Mechanisms
                    }
                }
            }
            catch (Exception)
            {
                //选定的对象不存在任何运动机构
            }
            //BasicDevice basicDevice = (BasicDevice)product.GetTechnologicalObject("BasicDevice");
            //Mechanisms TheMechanismsList = TheKinWorkbench.Mechanisms;
            RobGenericController Rgcr          = (RobGenericController)product.GetTechnologicalObject("RobGenericController");
            RobControllerFactory CRM           = (RobControllerFactory)product.GetTechnologicalObject("RobControllerFactory");
            GenericMotionProfile genericMotion = null;
            int ProfileCount = 0;

            Rgcr.GetMotionProfileCount(out ProfileCount);
            if (ProfileCount > 0)
            {
                string ProfileName = "DNBRobController";
                Rgcr.GetMotionProfile(ProfileName, out genericMotion);
            }
            InitController(Rgcr, CRM, 10, progressBar);
            Mechanism mechanism = cTheMechanisms.Add();
            //mechanism.FixedPart=
            ///RefDocument//mk:@MSITStore:F:\02%20我的知识库\05%20学习&总结资料\01%20CAA开发资料\V5Automation.chm::/online/CAAScdDmuUseCases/CAAKiiMechanismCreationSource.htm
            //string GetName = CRM.get_Name();
        }