diff --git a/CMS_CORE_Application/Form1.cs b/CMS_CORE_Application/Form1.cs index e28ebdc..06d212b 100644 --- a/CMS_CORE_Application/Form1.cs +++ b/CMS_CORE_Application/Form1.cs @@ -137,11 +137,13 @@ namespace CMS_CORE_Application cmsError = N.NC_GetAvailableLanguages(ref info); cmsError = N.NC_WLanguage(new CultureInfo("it")); - if (cmsError.IsError()) { error = true; SetError(Lines, cmsError); } + if (cmsError.IsError()) + { error = true; SetError(Lines, cmsError); } cmsError = N.NC_WLanguage(new CultureInfo("en")); - if (cmsError.IsError()) { error = true; SetError(Lines, cmsError); } + if (cmsError.IsError()) + { error = true; SetError(Lines, cmsError); } sw.Stop(); Console.WriteLine(sw.ElapsedMilliseconds); diff --git a/CMS_CORE_Library/CMS_CORE_Library.csproj b/CMS_CORE_Library/CMS_CORE_Library.csproj index f8caa23..bcce2d5 100644 --- a/CMS_CORE_Library/CMS_CORE_Library.csproj +++ b/CMS_CORE_Library/CMS_CORE_Library.csproj @@ -1116,24 +1116,12 @@ - - Always - - - Always - Always - - Always - Always - - Always - Always diff --git a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs index e71b481..37e6b03 100644 --- a/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs +++ b/CMS_CORE_Library/Fanuc/Nc_Fanuc.cs @@ -253,37 +253,53 @@ namespace CMS_CORE_Library.Fanuc public override CmsError NC_WLanguage(CultureInfo Language) { // set bit 7 to TRUE - byte langToWrite = (byte)(ConvertToNCLanguage(Language, out bool isSpecial) | 128); + //byte langToWrite = (byte)(ConvertToNCLanguage(Language, out bool isSpecial) | 128); - // write the byte - CmsError cmsError = MEM_RWByte(W, 0, PARAM_LING_FANUC_W.MemType, PARAM_LING_FANUC_W.Address, 0, ref langToWrite); - if (cmsError.IsError()) - return cmsError; + //// write the byte + //CmsError cmsError = MEM_RWByte(W, 0, PARAM_LING_FANUC_W.MemType, PARAM_LING_FANUC_W.Address, 0, ref langToWrite); + //if (cmsError.IsError()) + // return cmsError; - // Set reset bit - bool b = false; - int n = 50; - do - { - // Wait before read - Thread.Sleep(100); + //// Set reset bit + //bool b = false; + //int n = 25; + //do + //{ + // // Wait before read + // Thread.Sleep(200); - cmsError = MEM_RWBoolean(R, 0, MEMORY_TYPE.Fanuc_F, 545, 0, ref b); - // Decrement - n--; - } while (!b && n > 0); + // cmsError = MEM_RWBoolean(R, 0, MEMORY_TYPE.Fanuc_F, 545, 0, ref b); + // // Decrement + // n--; + //} while (!b && n > 0); - b = false; - cmsError = MEM_RWBoolean(W, 0, PARAM_LING_FANUC_W.MemType, PARAM_LING_FANUC_W.Address, 7, ref b); - if (cmsError.IsError()) - return cmsError; + //b = false; + //cmsError = MEM_RWBoolean(W, 0, PARAM_LING_FANUC_W.MemType, PARAM_LING_FANUC_W.Address, 7, ref b); + //if (cmsError.IsError()) + // return cmsError; + + +/////// FANUC METODO +// + //byte lang = ConvertToNCLanguage(Language, out bool isSpecial); + //ushort hndl; + + ////Execute the method + //short nReturn = Focas1.cnc_allclibhndl3(Ip, Port, 5, out hndl); + + //nReturn = Focas1.cnc_chglang(hndl, lang); + ////Throw Exception if there's an error + //if (nReturn != 0) + // return GetNcError(nReturn); + + //nReturn = Focas1.cnc_freelibhndl(hndl); + + //// Write if the selected language is special + //CmsError cmsError = MEM_RWBoolean(W, 0, SPECIAL_LANGUAGE_BIT.MemType, SPECIAL_LANGUAGE_BIT.Address, SPECIAL_LANGUAGE_BIT.SubAddress, ref isSpecial); + //if (cmsError.IsError()) + // return cmsError; - // Write if the selected language is special - cmsError = MEM_RWBoolean(W, 0, SPECIAL_LANGUAGE_BIT.MemType, SPECIAL_LANGUAGE_BIT.Address, SPECIAL_LANGUAGE_BIT.SubAddress, ref isSpecial); - if (cmsError.IsError()) - return cmsError; return NO_ERROR; - } // Get the NC Serial Number diff --git a/CMS_CORE_Library/Fanuc/fwlib32_64.cs b/CMS_CORE_Library/Fanuc/fwlib32_64.cs index a6a6a24..fc07ea6 100644 --- a/CMS_CORE_Library/Fanuc/fwlib32_64.cs +++ b/CMS_CORE_Library/Fanuc/fwlib32_64.cs @@ -11762,8 +11762,12 @@ internal class Focas1 [DllImport(FOCAS_LIB_NAME, EntryPoint = "cnc_getcurscrn")] internal static extern short cnc_getcurscrn(ushort FlibHndl, out short scrn_no); - - internal enum page_code: short + + // funzioni aggiunte al marshalling + [DllImport("FWLIB32.dll", EntryPoint = "cnc_chglang")] + public static extern short cnc_chglang(ushort FlibHndl, byte b); + + internal enum page_code: short { //POSITION ABS = 0x0100, diff --git a/CMS_CORE_Library/Fwlib32.dll b/CMS_CORE_Library/Fwlib32.dll index d74e191..fdad4ef 100644 Binary files a/CMS_CORE_Library/Fwlib32.dll and b/CMS_CORE_Library/Fwlib32.dll differ diff --git a/CMS_CORE_Library/Siemens/Nc_Siemens.cs b/CMS_CORE_Library/Siemens/Nc_Siemens.cs index 0794d6c..f273be1 100644 --- a/CMS_CORE_Library/Siemens/Nc_Siemens.cs +++ b/CMS_CORE_Library/Siemens/Nc_Siemens.cs @@ -516,12 +516,12 @@ namespace CMS_CORE_Library.Siemens // Set the NC Language public override CmsError NC_WLanguage(CultureInfo Language) { - CmsError cmsError = CheckConnection(); - if (cmsError.IsError()) - return cmsError; + //CmsError cmsError = CheckConnection(); + //if (cmsError.IsError()) + // return cmsError; - // Write write the language - Infrastructure.CurrentLanguage = ConvertToNCLanguage(Language); + //// Write write the language + //Infrastructure.CurrentLanguage = ConvertToNCLanguage(Language); return NO_ERROR; } diff --git a/CMS_CORE_Library/fwlibe1.dll b/CMS_CORE_Library/fwlibe1.dll index 41f87b0..e041f2e 100644 Binary files a/CMS_CORE_Library/fwlibe1.dll and b/CMS_CORE_Library/fwlibe1.dll differ