This commit is contained in:
Lucio Maranta
2019-07-18 16:11:43 +00:00
parent 3e1bccb950
commit eeee2d4c66
7 changed files with 56 additions and 46 deletions
+4 -2
View File
@@ -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);
-12
View File
@@ -1116,24 +1116,12 @@
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="fwlib30i.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="fwlib30i64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Fwlib32.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Fwlib64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="fwlibe1.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="fwlibe64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="OsaiTool.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
+41 -25
View File
@@ -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
+6 -2
View File
@@ -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,
Binary file not shown.
+5 -5
View File
@@ -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;
}
Binary file not shown.