Ejemplo n.º 1
0
        /// <summary>
        /// 取得ToolNumber
        /// </summary>
        /// <param name="singleOper"></param>
        /// <param name="operHolderDescription"></param>
        /// <returns></returns>
        public static string AskOperToolNumber(NXOpen.CAM.Operation singleOper)
        {
            string operToolNumber = "0";

            try
            {
                NCGroup         singleOperParent = singleOper.GetParent(CAMSetup.View.MachineTool);            //由Oper取得刀子
                NXOpen.CAM.Tool tool             = (NXOpen.CAM.Tool)NXObjectManager.Get(singleOperParent.Tag); //取得Oper的刀子名稱

                return(operToolNumber = CaxOper.AskToolNumber(tool));

                /*註解(如果AskToolNumber測試失敗,則回覆程式碼)
                 * Tool.Types type;
                 * Tool.Subtypes subtype;
                 * tool.GetTypeAndSubtype(out type, out subtype);
                 *
                 * if (type == Tool.Types.Barrel)
                 * {
                 *  NXOpen.CAM.BarrelToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateBarrelToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 * else if (type == Tool.Types.Drill)
                 * {
                 *  NXOpen.CAM.DrillStdToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateDrillStdToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 * else if (type == Tool.Types.DrillSpcGroove)
                 * {
                 *  NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 * else if (type == Tool.Types.Mill)
                 * {
                 *  NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 * else if (type == Tool.Types.MillForm)
                 * {
                 *  NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 * else if (type == Tool.Types.Solid)
                 * {
                 *
                 * }
                 * else if (type == Tool.Types.Tcutter)
                 * {
                 *  NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 * else if (type == Tool.Types.Thread)
                 * {
                 *  NXOpen.CAM.ThreadToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateThreadToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 * else if (type == Tool.Types.Turn)
                 * {
                 *  NXOpen.CAM.TurningToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateTurnToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 * else if (type == Tool.Types.Wedm)
                 * {
                 *
                 * }
                 * else if (type == Tool.Types.Groove)
                 * {
                 *  NXOpen.CAM.GrooveToolBuilder ToolBuilder1;
                 *  ToolBuilder1 = workPart.CAMSetup.CAMGroupCollection.CreateGrooveToolBuilder(tool);
                 *  operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                 *  return operToolNumber;
                 * }
                 */
            }
            catch (System.Exception ex)
            {
                operToolNumber = "尚未建立Builder存取資料";
                return(operToolNumber);
            }
            return(operToolNumber);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 取得ToolNumber
        /// </summary>
        /// <param name="singleOper"></param>
        /// <param name="operHolderDescription"></param>
        /// <returns></returns>
        public static string AskOperToolNumber(NXOpen.CAM.Operation singleOper)
        {
            string operToolNumber = "0";

            try
            {
                NCGroup         singleOperParent = singleOper.GetParent(CAMSetup.View.MachineTool);            //由Oper取得刀子
                NXOpen.CAM.Tool tool             = (NXOpen.CAM.Tool)NXObjectManager.Get(singleOperParent.Tag); //取得Oper的刀子名稱
                Tool.Types      type;
                Tool.Subtypes   subtype;
                tool.GetTypeAndSubtype(out type, out subtype);
                if (type == Tool.Types.Barrel)
                {
                    NXOpen.CAM.BarrelToolBuilder ToolBuilder1;
                    ToolBuilder1   = workPart.CAMSetup.CAMGroupCollection.CreateBarrelToolBuilder(tool);
                    operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                    return(operToolNumber);
                }
                else if (type == Tool.Types.Drill)
                {
                    NXOpen.CAM.DrillStdToolBuilder ToolBuilder1;
                    ToolBuilder1   = workPart.CAMSetup.CAMGroupCollection.CreateDrillStdToolBuilder(tool);
                    operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                    return(operToolNumber);
                }
                else if (type == Tool.Types.DrillSpcGroove)
                {
                    NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                    ToolBuilder1   = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                    operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                    return(operToolNumber);
                }
                else if (type == Tool.Types.Mill)
                {
                    NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                    ToolBuilder1   = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                    operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                    return(operToolNumber);
                }
                else if (type == Tool.Types.MillForm)
                {
                    NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                    ToolBuilder1   = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                    operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                    return(operToolNumber);
                }
                else if (type == Tool.Types.Solid)
                {
                }
                else if (type == Tool.Types.Tcutter)
                {
                    NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                    ToolBuilder1   = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                    operToolNumber = ToolBuilder1.TlNumberBuilder.Value.ToString();
                    return(operToolNumber);
                }
                else if (type == Tool.Types.Thread)
                {
                }
                else if (type == Tool.Types.Turn)
                {
                }
                else if (type == Tool.Types.Wedm)
                {
                }
                else if (type == Tool.Types.Groove)
                {
                }
            }
            catch (System.Exception ex)
            {
                operToolNumber = "尚未建立Builder存取資料";
                return(operToolNumber);
            }
            return(operToolNumber);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 取得Operation的HolderDescription名稱
        /// </summary>
        /// <param name="singleOper"></param>
        /// <param name="operHolderDescription"></param>
        /// <returns></returns>
        public static string AskOperHolderDescription(NXOpen.CAM.Operation singleOper)
        {
            string operHolderDescription = "";

            try
            {
                NCGroup         singleOperParent = singleOper.GetParent(CAMSetup.View.MachineTool);            //由Oper取得刀子
                NXOpen.CAM.Tool tool             = (NXOpen.CAM.Tool)NXObjectManager.Get(singleOperParent.Tag); //取得Oper的刀子名稱
                Tool.Types      type;
                Tool.Subtypes   subtype;
                tool.GetTypeAndSubtype(out type, out subtype);
                //CaxLog.ShowListingWindow(type.ToString());
                //CaxLog.ShowListingWindow(subtype.ToString());
                //CaxLog.ShowListingWindow("---");
                //CaxLog.ShowListingWindow(singleOper.Name.ToString());
                if (type == Tool.Types.Barrel)
                {
                    NXOpen.CAM.BarrelToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateBarrelToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlHolderDescription;
                    return(operHolderDescription);
                }
                else if (type == Tool.Types.Drill)
                {
                    NXOpen.CAM.DrillStdToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateDrillStdToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlHolderDescription;
                    //CaxLog.ShowListingWindow(operHolderDescription);
                    return(operHolderDescription);
                }
                else if (type == Tool.Types.DrillSpcGroove)
                {
                    NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlHolderDescription;
                    return(operHolderDescription);
                }
                else if (type == Tool.Types.Mill)
                {
                    NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlHolderDescription;
                    return(operHolderDescription);
                }
                else if (type == Tool.Types.MillForm)
                {
                    NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlHolderDescription;
                    return(operHolderDescription);
                }
                else if (type == Tool.Types.Solid)
                {
                }
                else if (type == Tool.Types.Tcutter)
                {
                    NXOpen.CAM.MillingToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateMillToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlHolderDescription;
                    return(operHolderDescription);
                }
                else if (type == Tool.Types.Thread)
                {
                    NXOpen.CAM.ThreadToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateThreadToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlDescription; //CaxLog.ShowListingWindow(operHolderDescription);
                    //operHolderDescription = ToolBuilder1.HolderHand.ToString(); CaxLog.ShowListingWindow(operHolderDescription);
                    //operHolderDescription = ToolBuilder1.HolderGrooveHand.ToString(); CaxLog.ShowListingWindow(operHolderDescription);
                    //CaxLog.ShowListingWindow("---");
                    return(operHolderDescription);
                }
                else if (type == Tool.Types.Turn)
                {
                    NXOpen.CAM.TurningToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateTurnToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlDescription; //CaxLog.ShowListingWindow(operHolderDescription);
                    //operHolderDescription = ToolBuilder1.HolderHand.ToString(); CaxLog.ShowListingWindow(operHolderDescription);
                    //operHolderDescription = ToolBuilder1.HolderGrooveHand.ToString(); CaxLog.ShowListingWindow(operHolderDescription);
                    //CaxLog.ShowListingWindow("---");
                    return(operHolderDescription);
                }
                else if (type == Tool.Types.Wedm)
                {
                }
                else if (type == Tool.Types.Groove)
                {
                    NXOpen.CAM.GrooveToolBuilder ToolBuilder1;
                    ToolBuilder1          = workPart.CAMSetup.CAMGroupCollection.CreateGrooveToolBuilder(tool);
                    operHolderDescription = ToolBuilder1.TlDescription; //CaxLog.ShowListingWindow(operHolderDescription);
                    //operHolderDescription = ToolBuilder1.HolderHand.ToString(); CaxLog.ShowListingWindow(operHolderDescription);
                    //operHolderDescription = ToolBuilder1.HolderGrooveHand.ToString(); CaxLog.ShowListingWindow(operHolderDescription);
                    //CaxLog.ShowListingWindow("---");
                    return(operHolderDescription);
                }
            }
            catch (System.Exception ex)
            {
                operHolderDescription = "尚未建立Builder存取資料";
                return(operHolderDescription);
            }
            return(operHolderDescription);
        }