diff --git a/IntegrationEgaltech/BTL.cs b/IntegrationEgaltech/BTL.cs index 0d38008..7dabfa3 100644 --- a/IntegrationEgaltech/BTL.cs +++ b/IntegrationEgaltech/BTL.cs @@ -107,7 +107,18 @@ namespace ib.essetre.integration.egaltech double wid = Convert.ToDouble( singlePart.width) * Math.Pow( 10, Constants.scaleUnit) ; int intWid = Convert.ToInt32( wid) ; tw.WriteLine( Constants.WIDTH + intWid.ToString( "D8")) ; - + + if (singlePart.Offsets[0] != "0" || singlePart.Offsets[1] != "0" || + singlePart.Offsets[2] != "0" || singlePart.Offsets[3] != "0" || singlePart.Offsets[4] != "0") { + tw.Write(Constants.PARTOFFSET); + tw.Write(" P04:" + MultAndConvertTo8(singlePart.Offsets[0])); + tw.Write(" P11:" + MultAndConvertTo8(singlePart.Offsets[1])); + tw.Write(" P12:" + MultAndConvertTo8(singlePart.Offsets[2])); + tw.Write(" P13:" + MultAndConvertTo8(singlePart.Offsets[3])); + tw.Write(" P14:" + MultAndConvertTo8(singlePart.Offsets[4])); + tw.WriteLine(""); + } + string posX = singlePart.x.ToString( "0.00", System.Globalization.CultureInfo.InvariantCulture) ; tw.WriteLine( Constants.USERATTRIBUTE + "\"POSX\":" + "\"" + posX + "\"") ; @@ -647,6 +658,7 @@ namespace ib.essetre.integration.egaltech public string height ; public string width ; public string Material ; + public List Offsets ; public string Type ; public List features ; public double x ; diff --git a/IntegrationEgaltech/Constants.cs b/IntegrationEgaltech/Constants.cs index 41b5dfa..afc8d97 100644 --- a/IntegrationEgaltech/Constants.cs +++ b/IntegrationEgaltech/Constants.cs @@ -22,6 +22,7 @@ namespace ib.essetre.integration.egaltech public const string LENGTH = "LENGTH: " ; public const string HEIGHT = "HEIGHT: " ; public const string WIDTH = "WIDTH: " ; + public const string PARTOFFSET = "PARTOFFSET: " ; public const string OUTLINE_KEY = "OUTLINE: "; public const string APERTURE_KEY = "APERTURE: "; public const string SIDE = "SIDE: "; diff --git a/IntegrationEgaltech/Generator.cs b/IntegrationEgaltech/Generator.cs index 1e9dadd..b0d7275 100644 --- a/IntegrationEgaltech/Generator.cs +++ b/IntegrationEgaltech/Generator.cs @@ -611,6 +611,7 @@ namespace ib.essetre.integration.egaltech if ( bFirst) { readPart.singleMemberNumber = GetElementSN( (int)dRowF["elementId"], (int)dRowF["projectId"]) ; readPart.Material = GetElementMaterial( (int)dRowF["elementId"], (int)dRowF["projectId"]) ; + readPart.Offsets = GetElementOffsets((int)dRowF["elementId"], (int)dRowF["projectId"]); readPart.Type = GetElementType( (int)dRowF["elementId"], (int)dRowF["projectId"]) ; readPart.count = "1" ; readPart.length = dRowF["length"].ToString() ; @@ -764,6 +765,7 @@ namespace ib.essetre.integration.egaltech if ( bFirst) { readPart.singleMemberNumber = GetElementSN( (int)dRow0["elementId"], (int)dRow0["projectId"]) ; readPart.Material = GetElementMaterial( (int)dRow0["elementId"], (int)dRow0["projectId"]) ; + readPart.Offsets = GetElementOffsets((int)dRowF["elementId"], (int)dRowF["projectId"]); readPart.Type = GetElementType( (int)dRow0["elementId"], (int)dRow0["projectId"]) ; readPart.count = "1" ; readPart.length = dRowF["length"].ToString() ; @@ -971,6 +973,46 @@ namespace ib.essetre.integration.egaltech return Mat ; } + private static List GetElementOffsets(int ElementId, int ProjectId) + { + List Offsets = new List{ "0", "0", "0", "0", "0"} ; + + string sqlElementMat = "SELECT name, value " + + "FROM dbo.vw_ElementParam " + + "WHERE elementId = @firstId " + + "AND projectId = @secondId " + + "AND name like 'PARTOFFSET_%' "; + + // Connessione al DB ed esecuzione query + using (SqlConnection cn = new SqlConnection(_SqlConnectionStr)) + { + cn.Open() ; + using (SqlCommand sqlCommand = new SqlCommand(sqlElementMat, cn)) + { + sqlCommand.Parameters.Add("@firstId", SqlDbType.Int); + sqlCommand.Parameters.Add("@secondId", SqlDbType.Int); + sqlCommand.Parameters["@firstId"].Value = ElementId; + sqlCommand.Parameters["@secondId"].Value = ProjectId; + SqlDataReader reader = sqlCommand.ExecuteReader(); + while (reader.Read()) { + string sName = Convert.ToString(reader["name"]); + string sVal = Convert.ToString(reader["value"]); + if ( sName == "PARTOFFSET_P04") + Offsets[0] = sVal ; + else if (sName == "PARTOFFSET_P11") + Offsets[1] = sVal ; + else if (sName == "PARTOFFSET_P12") + Offsets[2] = sVal ; + else if (sName == "PARTOFFSET_P13") + Offsets[3] = sVal ; + else if (sName == "PARTOFFSET_P14") + Offsets[4] = sVal ; + } + } + } + + return Offsets ; + } //------------------------------------------------------------------------------------------------------------- // Recupera la lunghezza della barra nel caso Produzione (colonna "l") diff --git a/IntegrationEgaltech/Properties/AssemblyInfo.cs b/IntegrationEgaltech/Properties/AssemblyInfo.cs index 0042114..6dbdae0 100644 --- a/IntegrationEgaltech/Properties/AssemblyInfo.cs +++ b/IntegrationEgaltech/Properties/AssemblyInfo.cs @@ -36,5 +36,5 @@ using System.Runtime.InteropServices; // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build // usando l'asterisco '*' come illustrato di seguito: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.7.7.1")] -[assembly: AssemblyFileVersion("2.7.7.1")] +[assembly: AssemblyVersion("3.1.1.1")] +[assembly: AssemblyFileVersion("3.1.1.1")] diff --git a/IntegrationEgaltech2/IntegrationEgaltech2.aps b/IntegrationEgaltech2/IntegrationEgaltech2.aps index b297e67..33bd1fe 100644 Binary files a/IntegrationEgaltech2/IntegrationEgaltech2.aps and b/IntegrationEgaltech2/IntegrationEgaltech2.aps differ diff --git a/IntegrationEgaltech2/IntegrationEgaltech2.rc b/IntegrationEgaltech2/IntegrationEgaltech2.rc index bfce1c0..5eb4888 100644 Binary files a/IntegrationEgaltech2/IntegrationEgaltech2.rc and b/IntegrationEgaltech2/IntegrationEgaltech2.rc differ