Beispiel #1
0
        public Dictionary <string, string> GetTool()
        {
            int    nErr;
            string strRetBuffer = "";

            // needs AREA_DNC, see description in PDF manual or "Heidenhain_new_Functions.txt"

            nErr = SuperCom.PLSV2.Heidenhain.HN_GetRunInfoEx(CommId,
                                                             SuperCom.PLSV2.Heidenhain.RunInfoRequestType.HN_LSV2_RUNINFO_TOOL,
                                                             ref strRetBuffer);

            Dictionary <string, string> tool = new Dictionary <string, string>();

            if (nErr == SuperCom.PLSV2.Heidenhain.HN_NO_ERROR)
            {
                //Console.Out.WriteLine(" ProgramStatus={0}", SuperCom.GetStrVal(strRetBuffer, "ProgramStatus"));
                tool["ToolNr"]    = SuperCom.GetStrVal(strRetBuffer, "ToolNr");
                tool["ToolIndex"] = SuperCom.GetStrVal(strRetBuffer, "ToolIndex");
                tool["ToolAxis"]  = SuperCom.GetStrVal(strRetBuffer, "ToolAxis");
                tool["ToolLen"]   = SuperCom.GetStrVal(strRetBuffer, "ToolLen");
                tool["ToolRad"]   = SuperCom.GetStrVal(strRetBuffer, "ToolRad");

                return(tool);
            }

            else
            {
                //Console.Out.WriteLine("err {0}, {1}", nErr, HNGetLastError());
                return(null);
            }
        }
Beispiel #2
0
        public Dictionary <string, string> GetExecutionPoint()
        {
            int    nErr;
            string strRetBuffer = "";

            // needs AREA_DNC, see description in PDF manual or "Heidenhain_new_Functions.txt"

            nErr = SuperCom.PLSV2.Heidenhain.HN_GetRunInfoEx(CommId,
                                                             SuperCom.PLSV2.Heidenhain.RunInfoRequestType.HN_LSV2_RUNINFO_EXECUTION_POINT,
                                                             ref strRetBuffer);

            Dictionary <string, string> execution = new Dictionary <string, string>();

            if (nErr == SuperCom.PLSV2.Heidenhain.HN_NO_ERROR)
            {
                //Console.Out.WriteLine(" ProgramStatus={0}", SuperCom.GetStrVal(strRetBuffer, "ProgramStatus"));
                execution["BlockNr"]             = SuperCom.GetStrVal(strRetBuffer, "BlockNr");
                execution["NameSelectedProgram"] = SuperCom.GetStrVal(strRetBuffer, "NameSelectedProgram");
                execution["NameActiveProgram"]   = SuperCom.GetStrVal(strRetBuffer, "NameActiveProgram");

                return(execution);
            }

            else
            {
                //Console.Out.WriteLine("err {0}, {1}", nErr, HNGetLastError());
                return(null);
            }
        }
Beispiel #3
0
        public string GetExecutionMode()
        {
            int    nErr;
            string strRetBuffer = "";

            // needs AREA_DNC, see description in PDF manual or "Heidenhain_new_Functions.txt"

            nErr = SuperCom.PLSV2.Heidenhain.HN_GetRunInfoEx(CommId,
                                                             SuperCom.PLSV2.Heidenhain.RunInfoRequestType.HN_LSV2_RUNINFO_EXECUTION_MODE,
                                                             ref strRetBuffer);


            if (nErr == SuperCom.PLSV2.Heidenhain.HN_NO_ERROR)
            {
                //Console.Out.WriteLine(" ProgramStatus={0}", SuperCom.GetStrVal(strRetBuffer, "ProgramStatus"));
                string executionMode = SuperCom.GetStrVal(strRetBuffer, "ExecutionMode");

                return(executionMode);
            }

            else
            {
                Console.Out.WriteLine("MODE err {0}, {1}", nErr, HNGetLastError());
                return(null);
            }
        }
Beispiel #4
0
        public Error GetNextError()
        {
            int    nErr;
            string strRetBuffer = "";

            // needs AREA_DNC, see description in PDF manual or "Heidenhain_new_Functions.txt"

            nErr = SuperCom.PLSV2.Heidenhain.HN_GetRunInfoEx(CommId,
                                                             SuperCom.PLSV2.Heidenhain.RunInfoRequestType.HN_LSV2_RUNINFO_NEXT_ERROR,
                                                             ref strRetBuffer);

            if (nErr == SuperCom.PLSV2.Heidenhain.HN_NO_ERROR)
            {
                //Console.WriteLine("Com id: " + CommId);

                Error FirstError = new Error();

                string ErrorText = SuperCom.GetStrVal(strRetBuffer, "ErrorText");
                if (ErrorText.Length > 0)
                {
                    FirstError.ErrorText = ErrorText;
                }

                string ErrorClass = SuperCom.GetStrVal(strRetBuffer, "ErrorClass");
                if (ErrorClass.Length > 0)
                {
                    FirstError.ErrorClass = ErrorClass;
                }

                string ErrorGroup = SuperCom.GetStrVal(strRetBuffer, "ErrorGroup");
                if (ErrorGroup.Length > 0)
                {
                    FirstError.ErrorGroup = ErrorGroup;
                }

                string ErrorNumber = SuperCom.GetStrVal(strRetBuffer, "ErrorNumber");
                if (ErrorNumber.Length > 0)
                {
                    FirstError.ErrorNumber = ErrorNumber;
                }

                Console.WriteLine("Next Error: " + FirstError.ErrorText);

                return(FirstError);
            }
            else
            {
                //Console.Out.WriteLine("err {0}, {1}", nErr, HNGetLastError());

                return(null);
            }
        }
Beispiel #5
0
        // AREA INSPECT
        public void GetTNCVersion()
        {
            String sVersionStrings;

            sVersionStrings = "";
            if (SuperCom.PLSV2.Heidenhain.HN_ERR_NONE == SuperCom.PLSV2.Heidenhain.HN_GetTNCVersionEx(CommId, ref sVersionStrings))
            {
                String s;
                Console.Out.WriteLine("Extended Version:");
                // A possible result string:
                // "TNC-Type=iTNC530;NC-Ver=340494 06 SP7;PLC-Ver=BASIS 54;Option1=%11111111;"

                // The first three values may be the most interested.

                s = SuperCom.GetStrVal(sVersionStrings, "TNC-Type");
                if (s.Length > 0)
                {
                    Console.Out.WriteLine("  TNC-Type: {0}", s);
                }

                s = SuperCom.GetStrVal(sVersionStrings, "NC-Ver");
                if (s.Length > 0)
                {
                    Console.Out.WriteLine("  NC-Ver  : {0}", s);
                }

                s = SuperCom.GetStrVal(sVersionStrings, "PLC-Ver");
                if (s.Length > 0)
                {
                    Console.Out.WriteLine("  PLC-Ver : {0}", s);
                }

                s = SuperCom.GetStrVal(sVersionStrings, "Option1");
                if (s.Length > 0)
                {
                    Console.Out.WriteLine("  Option1 : {0}", s);
                }

                s = SuperCom.GetStrVal(sVersionStrings, "Option2");
                if (s.Length > 0)
                {
                    Console.Out.WriteLine("  Option2 : {0}", s);
                }
            }
        }
Beispiel #6
0
        public String GetProgramStatus()
        {
            int    nErr;
            string strRetBuffer = "";

            // needs AREA_DNC, see description in PDF manual or "Heidenhain_new_Functions.txt"

            nErr = SuperCom.PLSV2.Heidenhain.HN_GetRunInfoEx(CommId,
                                                             SuperCom.PLSV2.Heidenhain.RunInfoRequestType.HN_LSV2_RUNINFO_PROGRAM_STATUS,
                                                             ref strRetBuffer);

            if (nErr == SuperCom.PLSV2.Heidenhain.HN_NO_ERROR)
            {
                return(SuperCom.GetStrVal(strRetBuffer, "ProgramStatus"));
            }

            return(null);
        }
Beispiel #7
0
        public string GetMachineParameter(String strRequest)
        {
            int nErr;

            String strParamStringValues;

            strParamStringValues = "";

            nErr = SuperCom.PLSV2.Heidenhain.HN_GetMachineParameters(CommId, strRequest, ref strParamStringValues);
            string s = SuperCom.GetStrVal(strParamStringValues, strRequest);

            if (nErr == SuperCom.PLSV2.Heidenhain.HN_NO_ERROR)
            {
                return(s);//Console.Out.WriteLine(" OK, [{0}], [{1}], {2}", strRequest, strParamStringValues, s);
            }
            else
            {
                return(null);//Console.Out.WriteLine(" failed Err={0}, TNC ErrCode={1}", nErr, HNGetLastError());
            }
        }
Beispiel #8
0
        public String GetPositionControlCycleTime()
        {
            int    nErr;
            string strRetBuffer = "";

            // needs AREA_DNC, see description in PDF manual or "Heidenhain_new_Functions.txt"

            nErr = SuperCom.PLSV2.Heidenhain.HN_GetRunInfoEx(CommId,
                                                             SuperCom.PLSV2.Heidenhain.RunInfoRequestType.HN_LSV2_RUNINFO_PCCT,
                                                             ref strRetBuffer);

            if (nErr == SuperCom.PLSV2.Heidenhain.HN_NO_ERROR)
            {
                Console.Out.WriteLine(" ProgramStatus={0}", SuperCom.GetStrVal(strRetBuffer, "ProgramStatus"));
                return(SuperCom.GetStrVal(strRetBuffer, "Position-Control-Cycle-Time"));
            }

            else
            {
                Console.Out.WriteLine("err {0}, {1}", nErr, HNGetLastError());
                return(null);
            }
        }