public string SetGWACommand(int group = 0)
    {
      if (this.Value == null)
        return "";

      var member = this.Value as Structural1DElement;
      if (member.Value == null || member.Value.Count() == 0)
      {
        return "";
      }

      var keyword = typeof(GSA1DMember).GetGSAKeyword();

      if (!SchemaConversion.Helper.ValidateCoordinates(member.Value, out var nodeIndices))
      {
        Initialiser.AppResources.Cache.RemoveFromProvisional(keyword, member.ApplicationId);
        Initialiser.AppResources.Messenger.Message(MessageIntent.Display, MessageLevel.Error, 
          "Coordinates resolve to identical GSA nodes for application ID:", member.ApplicationId);
        return "";
      }

      var index = Initialiser.AppResources.Cache.ResolveIndex(typeof(GSA1DMember).GetGSAKeyword(), member.ApplicationId);

      var propKeyword = ((member.ElementType == Structural1DElementType.Spring) ? typeof(GSASpringProperty) : typeof(GSA1DProperty)).GetGSAKeyword();
      var indexResult = Initialiser.AppResources.Cache.LookupIndex(propKeyword, member.PropertyRef);
      //If the reference can't be found, then reserve a new index so that it at least doesn't point to any other existing record
      var propRef = indexResult ?? Initialiser.AppResources.Cache.ResolveIndex(propKeyword, member.PropertyRef);
      if (indexResult == null && member.ApplicationId != null)
      {
        if (member.PropertyRef == null)
        {
          Initialiser.AppResources.Messenger.Message(MessageIntent.Display, MessageLevel.Error, "Blank property references found for these Application IDs:",
            member.ApplicationId);
        }
        else
        {
          Initialiser.AppResources.Messenger.Message(MessageIntent.Display, MessageLevel.Error, "1D property references not found:",
            member.ApplicationId + " referencing " + member.PropertyRef);
        }
      }

      var sid = Helper.GenerateSID(member);
      var ls = new List<string>
      {
        "SET",
        keyword + (string.IsNullOrEmpty(sid) ? "" : ":" + sid),
        index.ToString(),
        member.Name == null || member.Name == "" ? " " : member.Name,
        "NO_RGB"
      };
      ls.Add(Structural1DElementTypeToString(member.ElementType));
      ls.Add("ALL"); // fire exposure reference, default to worst case (also GSA default)
      ls.Add(propRef.ToString());
      ls.Add(group != 0 ? group.ToString() : index.ToString()); // TODO: This allows for targeting of elements from members group
      ls.Add(string.Join(" ", nodeIndices));

      ls.Add("0"); // Orientation node
      if (member.Value == null)
      {
        ls.Add("0");
      }
      else
      {
        try
        {
          ls.Add(Helper.Get1DAngle(member.Value.ToArray(), member.ZAxis ?? new StructuralVectorThree(0, 0, 1)).ToString());
        }
        catch { ls.Add("0"); }
      }
      ls.Add(member.GSAMeshSize == null ? "0" : member.GSAMeshSize.ToString()); // Target mesh size
      ls.Add("YES"); // intersector - GSA default
      ls.Add((member.ElementType == Structural1DElementType.Spring) ? "SPRING" : "BEAM"); // analysis type - there are more options than this in GSA docs
      ls.Add("0"); // Fire
      ls.Add("0"); // Limiting temperature
      ls.Add("0"); // Time 1
      ls.Add("0"); // Time 2
      ls.Add("0"); // Time 3
      ls.Add("0"); // Time 4
      ls.Add((member.GSADummy.HasValue && member.GSADummy.Value) ? "DUMMY" : "ACTIVE");

      if (member.EndRelease == null || member.EndRelease.Count == 0)
      {
        ls.AddRange(new[] { EndReleaseToGWA(null), EndReleaseToGWA(null) });
      }
      else if (member.EndRelease != null && member.EndRelease.Count == 1)
      {
        ls.AddRange(new[] { EndReleaseToGWA(member.EndRelease.First()), EndReleaseToGWA(null) });
      }
      else
      {
        ls.AddRange(new[] { EndReleaseToGWA(member.EndRelease.First()), EndReleaseToGWA(member.EndRelease.Last()) });
      }

      ls.Add("Free"); // restraint_end_1
      ls.Add("Free"); // restraint_end_2

      ls.Add("AUTOMATIC"); // Effective length option
      ls.Add("0"); // height
      ls.Add("SHR_CENTRE"); // load_ref

      if (member.Offset == null)
      {
        ls.Add("NO_OFF");
      }
      else
      {
        ls.Add("YES");
        ls.Add("MAN");
        ls.Add("MAN");
        try
        {
          var subLs = new List<string>
        {
          member.Offset[0].Value[0].ToString(), // Offset x-start
          member.Offset[1].Value[0].ToString(), // Offset x-end

          member.Offset[0].Value[1].ToString(),
          member.Offset[0].Value[2].ToString()
        };

          ls.AddRange(subLs);
        }
        catch
        {
          ls.AddRange(new[] { "0", "0", "0", "0" });
        }
      }

      return (string.Join(Initialiser.AppResources.Proxy.GwaDelimiter.ToString(), ls));
    }
    public string SetGWACommand(int group = 0)
    {
      if (this.Value == null)
        return "";

      var element = this.Value as Structural1DElement;

      if (element.Value == null || element.Value.Count() == 0)
        return "";

      var keyword = typeof(GSA1DElement).GetGSAKeyword();

      if (!SchemaConversion.Helper.ValidateCoordinates(element.Value, out var nodeIndices))
      {
        Initialiser.AppResources.Cache.RemoveFromProvisional(keyword, element.ApplicationId);
        Initialiser.AppResources.Messenger.Message(MessageIntent.Display, MessageLevel.Error, 
          "All coordinates resolve to identical GSA node for application ID:", element.ApplicationId);
        return "";
      }

      var index = Initialiser.AppResources.Cache.ResolveIndex(keyword, element.ApplicationId);

      var propKeyword = (element.ElementType == Structural1DElementType.Spring)
        ? typeof(GSASpringProperty).GetGSAKeyword()
        : typeof(GSA1DProperty).GetGSAKeyword();

      var indexResult = Initialiser.AppResources.Cache.LookupIndex(propKeyword, element.PropertyRef);

      //If the reference can't be found, then reserve a new index so that it at least doesn't point to any other existing record
      var propRef = indexResult ?? Initialiser.AppResources.Cache.ResolveIndex(propKeyword, element.PropertyRef);
      if (indexResult == null && element.ApplicationId != null)
      {
        if (element.PropertyRef == null)
        {
          Initialiser.AppResources.Messenger.Message(MessageIntent.Display, MessageLevel.Error, "Blank property references found for these Application IDs:",
            element.ApplicationId);
        }
        else
        {
          Initialiser.AppResources.Messenger.Message(MessageIntent.Display, MessageLevel.Error, "1D property references not found:",
            element.ApplicationId + " referencing " + element.PropertyRef);
        }
      }

      var sid = Helper.GenerateSID(element);
      var ls = new List<string>
      {
        "SET",
        keyword + (string.IsNullOrEmpty(sid) ? "" : ":" + sid),
        index.ToString(),
        element.Name == null || element.Name == "" ? " " : element.Name,
        "NO_RGB",
        element.ElementType == Structural1DElementType.Spring ? "SPRING" : "BEAM", // Type
        propRef.ToString(), // Prop
        group.ToString() // Group
      };
      
      // topo()
      foreach (var i in nodeIndices)
      {
        ls.Add(i.ToString());
      }

      ls.Add("0"); // Orientation Node

      // orient_angle
      double orientAngle = 0;
      try
      {
        if (element.ZAxis != null)
        {
          orientAngle = Helper.Get1DAngle(element.Value.ToArray(), element.ZAxis);
        }
      }
      catch { }
      ls.Add(orientAngle.ToString());
      
      // is_rls { | k }
      try
      {
        var subLs = new List<string>();
        var anyReleases = false;
        if (element.EndRelease != null && element.EndRelease.Count() > 0)
        {
          if (element.EndRelease[0].Value.Any(x => x) || (element.EndRelease.Count() > 1 && element.EndRelease[1].Value.Any(x => x)))
          {
            anyReleases = true;
          }
        }
        if (anyReleases)
        {
          subLs.Add("RLS");
          var end1 = "";

          end1 += element.EndRelease[0].Value[0] ? "R" : "F";
          end1 += element.EndRelease[0].Value[1] ? "R" : "F";
          end1 += element.EndRelease[0].Value[2] ? "R" : "F";
          end1 += element.EndRelease[0].Value[3] ? "R" : "F";
          end1 += element.EndRelease[0].Value[4] ? "R" : "F";
          end1 += element.EndRelease[0].Value[5] ? "R" : "F";
          subLs.Add(end1);

          if (element.EndRelease.Count() > 1)
          {
            var end2 = "";

            end2 += element.EndRelease[1].Value[0] ? "R" : "F";
            end2 += element.EndRelease[1].Value[1] ? "R" : "F";
            end2 += element.EndRelease[1].Value[2] ? "R" : "F";
            end2 += element.EndRelease[1].Value[3] ? "R" : "F";
            end2 += element.EndRelease[1].Value[4] ? "R" : "F";
            end2 += element.EndRelease[1].Value[5] ? "R" : "F";

            subLs.Add(end2);
          }
          else
          {
            subLs.Add("FFFFFF");
          }

          ls.AddRange(subLs);
        }
        else
        {
          ls.Add("NO_RLS");
        }
      }
      catch { ls.Add("NO_RLS"); }

      // off_x1 | off_x2 | off_y | off_z
      var offsets = new List<double>() { 0, 0, 0, 0 };
      try
      {
        if (element.Offset != null)
        {
          offsets[0] = element.Offset[0].Value[0];
          offsets[1] = element.Offset[1].Value[0];
          offsets[2] = element.Offset[0].Value[1];
          offsets[3] = element.Offset[0].Value[2];
        }
      }
      catch { }
      ls.AddRange(offsets.Select(o => o.ToString()));

      ls.Add(""); // parent_member

      ls.Add((element.GSADummy.HasValue && element.GSADummy.Value) ? "DUMMY" : ""); // dummy

      return (string.Join(Initialiser.AppResources.Proxy.GwaDelimiter.ToString(), ls));
    }
Esempio n. 3
0
    public string SetGWACommand(int group = 0)
    {
      if (this.Value == null)
        return "";

      var member = this.Value as Structural1DElement;
      if (member.Value == null || member.Value.Count() == 0)
        return "";

      var keyword = typeof(GSA1DMember).GetGSAKeyword();

      var index = Initialiser.AppResources.Cache.ResolveIndex(typeof(GSA1DMember).GetGSAKeyword(), member.ApplicationId);

      var propKeyword = ((member.ElementType == Structural1DElementType.Spring) ? typeof(GSASpringProperty) : typeof(GSA1DProperty)).GetGSAKeyword();
      var indexResult = Initialiser.AppResources.Cache.LookupIndex(propKeyword, member.PropertyRef);
      //If the reference can't be found, then reserve a new index so that it at least doesn't point to any other existing record
      var propRef = indexResult ?? Initialiser.AppResources.Cache.ResolveIndex(propKeyword, member.PropertyRef);
      if (indexResult == null && member.ApplicationId != null)
      {
        if (member.PropertyRef == null)
        {
          Helper.SafeDisplay("Blank property references found for these Application IDs:", member.ApplicationId);
        }
        else
        {
          Helper.SafeDisplay("1D property references not found:", member.ApplicationId + " referencing " + member.PropertyRef);
        }
      }

      var sid = Helper.GenerateSID(member);
      var ls = new List<string>
      {
        "SET",
        keyword + (string.IsNullOrEmpty(sid) ? "" : ":" + sid),
        index.ToString(),
        member.Name == null || member.Name == "" ? " " : member.Name,
        "NO_RGB"
      };
      if (member.ElementType == Structural1DElementType.Beam)
        ls.Add("BEAM");
      else if (member.ElementType == Structural1DElementType.Column)
        ls.Add("COLUMN");
      else if (member.ElementType == Structural1DElementType.Cantilever)
        ls.Add("CANTILEVER");
      else
        ls.Add("1D_GENERIC");
      ls.Add("ALL"); // fire exposure reference, default to worst case (also GSA default)
      ls.Add(propRef.ToString());
      ls.Add(group != 0 ? group.ToString() : index.ToString()); // TODO: This allows for targeting of elements from members group
      var topo = "";
      if (member.Value != null)
      {
        for (var i = 0; i < member.Value.Count(); i += 3)
        {
          topo += Initialiser.AppResources.Proxy.NodeAt(member.Value[i], member.Value[i + 1], member.Value[i + 2], Initialiser.AppResources.Settings.CoincidentNodeAllowance).ToString() + " ";
        }
      }
      ls.Add(topo.TrimEnd());
      ls.Add("0"); // Orientation node
      if (member.Value == null)
      {
        ls.Add("0");
      }
      else
      {
        try
        {
          ls.Add(Helper.Get1DAngle(member.Value.ToArray(), member.ZAxis ?? new StructuralVectorThree(0, 0, 1)).ToString());
        }
        catch { ls.Add("0"); }
      }
      ls.Add(member.GSAMeshSize == null ? "0" : member.GSAMeshSize.ToString()); // Target mesh size
      ls.Add("YES"); // intersector - GSA default
      ls.Add((member.ElementType == Structural1DElementType.Spring) ? "SPRING" : "BEAM"); // analysis type - there are more options than this in GSA docs
      ls.Add("0"); // Fire
      ls.Add("0"); // Limiting temperature
      ls.Add("0"); // Time 1
      ls.Add("0"); // Time 2
      ls.Add("0"); // Time 3
      ls.Add("0"); // Time 4
      ls.Add((member.GSADummy.HasValue && member.GSADummy.Value) ? "DUMMY" : "ACTIVE");

      if (member.EndRelease == null || member.EndRelease.Count != 2)
        ls.AddRange(new[] { EndReleaseToGWA(null), EndReleaseToGWA(null) });
      else
        ls.AddRange(new[] { EndReleaseToGWA(member.EndRelease[0]), EndReleaseToGWA(member.EndRelease[1]) });

      ls.Add("Free"); // restraint_end_1
      ls.Add("Free"); // restraint_end_2

      ls.Add("AUTOMATIC"); // Effective length option
      ls.Add("0"); // height
      ls.Add("SHR_CENTRE"); // load_ref

      if (member.Offset == null)
      {
        ls.Add("NO_OFF");
      }
      else
      {
        ls.Add("YES");
        ls.Add("MAN");
        ls.Add("MAN");
        try
        {
          var subLs = new List<string>
        {
          member.Offset[0].Value[0].ToString(), // Offset x-start
          member.Offset[1].Value[0].ToString(), // Offset x-end

          member.Offset[0].Value[1].ToString(),
          member.Offset[0].Value[2].ToString()
        };

          ls.AddRange(subLs);
        }
        catch
        {
          ls.AddRange(new[] { "0", "0", "0", "0" });
        }
      }

      return (string.Join(Initialiser.AppResources.Proxy.GwaDelimiter.ToString(), ls));
    }
Esempio n. 4
0
    public string SetGWACommand(int group = 0)
    {
      if (this.Value == null)
        return "";

      var element = this.Value as Structural1DElement;

      if (element.Value == null || element.Value.Count() == 0)
        return "";

      var keyword = typeof(GSA1DElement).GetGSAKeyword();

      var index = Initialiser.AppResources.Cache.ResolveIndex(keyword, element.ApplicationId);

      var propKeyword = (element.ElementType == Structural1DElementType.Spring)
        ? typeof(GSASpringProperty).GetGSAKeyword()
        : typeof(GSA1DProperty).GetGSAKeyword();

      var indexResult = Initialiser.AppResources.Cache.LookupIndex(propKeyword, element.PropertyRef);

      //If the reference can't be found, then reserve a new index so that it at least doesn't point to any other existing record
      var propRef = indexResult ?? Initialiser.AppResources.Cache.ResolveIndex(propKeyword, element.PropertyRef);
      if (indexResult == null && element.ApplicationId != null)
      {
        if (element.PropertyRef == null)
        {
          Helper.SafeDisplay("Blank property references found for these Application IDs:", element.ApplicationId);
        }
        else
        {
          Helper.SafeDisplay("1D property references not found:", element.ApplicationId + " referencing " + element.PropertyRef);
        }
      }

      var sid = Helper.GenerateSID(element);
      var ls = new List<string>
      {
        "SET",
        keyword + (string.IsNullOrEmpty(sid) ? "" : ":" + sid),
        index.ToString(),
        element.Name == null || element.Name == "" ? " " : element.Name,
        "NO_RGB",
        "BEAM", // Type
        propRef.ToString(), // Prop
        group.ToString() // Group
      };
      
      // topo()
      for (var i = 0; i < element.Value.Count(); i += 3)
      {
        ls.Add(Initialiser.AppResources.Proxy.NodeAt(element.Value[i], element.Value[i + 1], element.Value[i + 2], Initialiser.AppResources.Settings.CoincidentNodeAllowance).ToString());
      }
      
      ls.Add("0"); // Orientation Node
      
      // orient_angle
      try
      {
        ls.Add(Helper.Get1DAngle(element.Value.ToArray(), element.ZAxis).ToString());
      }
      catch { ls.Add("0"); }
      
      // is_rls { | k }
      try
      {
        var subLs = new List<string>();
        if (element.EndRelease[0].Value.Any(x => x) || element.EndRelease[1].Value.Any(x => x))
        {
          subLs.Add("RLS");

          var end1 = "";

          end1 += element.EndRelease[0].Value[0] ? "R" : "F";
          end1 += element.EndRelease[0].Value[1] ? "R" : "F";
          end1 += element.EndRelease[0].Value[2] ? "R" : "F";
          end1 += element.EndRelease[0].Value[3] ? "R" : "F";
          end1 += element.EndRelease[0].Value[4] ? "R" : "F";
          end1 += element.EndRelease[0].Value[5] ? "R" : "F";

          subLs.Add(end1);

          var end2 = "";

          end2 += element.EndRelease[1].Value[0] ? "R" : "F";
          end2 += element.EndRelease[1].Value[1] ? "R" : "F";
          end2 += element.EndRelease[1].Value[2] ? "R" : "F";
          end2 += element.EndRelease[1].Value[3] ? "R" : "F";
          end2 += element.EndRelease[1].Value[4] ? "R" : "F";
          end2 += element.EndRelease[1].Value[5] ? "R" : "F";

          subLs.Add(end2);

          ls.AddRange(subLs);
        }
        else
          ls.Add("NO_RLS");
      }
      catch { ls.Add("NO_RLS"); }

      // off_x1 | off_x2 | off_y | off_z
      try
      {
        var subLs = new List<string>
        {
          element.Offset[0].Value[0].ToString(), // Offset x-start
          element.Offset[1].Value[0].ToString(), // Offset x-end

          element.Offset[0].Value[1].ToString(),
          element.Offset[0].Value[2].ToString()
        };

        ls.AddRange(subLs);
      }
      catch
      {
        ls.Add("0");
        ls.Add("0");
        ls.Add("0");
        ls.Add("0");
      }

      ls.Add(""); // parent_member

      ls.Add((element.GSADummy.HasValue && element.GSADummy.Value) ? "DUMMY" : ""); // dummy

      return (string.Join(Initialiser.AppResources.Proxy.GwaDelimiter.ToString(), ls));
    }
Esempio n. 5
0
        public string SetGWACommand(int group = 0)
        {
            if (this.Value == null)
            {
                return("");
            }

            var member = this.Value as Structural1DElement;

            if (member.Value == null || member.Value.Count() == 0)
            {
                return("");
            }

            var keyword = typeof(GSA1DMember).GetGSAKeyword();

            var index = Initialiser.Cache.ResolveIndex(typeof(GSA1DMember).GetGSAKeyword(), member.ApplicationId);

            var propKeyword = ((member.ElementType == Structural1DElementType.Spring) ? typeof(GSASpringProperty) : typeof(GSA1DProperty)).GetGSAKeyword();
            var indexResult = Initialiser.Cache.LookupIndex(propKeyword, member.PropertyRef);
            //If the reference can't be found, then reserve a new index so that it at least doesn't point to any other existing record
            var propRef = indexResult ?? Initialiser.Cache.ResolveIndex(propKeyword, member.PropertyRef);

            if (indexResult == null && member.ApplicationId != null)
            {
                if (member.PropertyRef == null)
                {
                    Helper.SafeDisplay("Blank property references found for these Application IDs:", member.ApplicationId);
                }
                else
                {
                    Helper.SafeDisplay("Property references not found:", member.ApplicationId + " referencing " + member.PropertyRef);
                }
            }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + Helper.GenerateSID(member),
                index.ToString(),
                member.Name == null || member.Name == "" ? " " : member.Name,
                "NO_RGB"
            };

            if (member.ElementType == Structural1DElementType.Beam)
            {
                ls.Add("BEAM");
            }
            else if (member.ElementType == Structural1DElementType.Column)
            {
                ls.Add("COLUMN");
            }
            else if (member.ElementType == Structural1DElementType.Cantilever)
            {
                ls.Add("CANTILEVER");
            }
            else
            {
                ls.Add("1D_GENERIC");
            }
            ls.Add(propRef.ToString());
            ls.Add(group != 0 ? group.ToString() : index.ToString()); // TODO: This allows for targeting of elements from members group
            var topo = "";

            if (member.Value != null)
            {
                for (var i = 0; i < member.Value.Count(); i += 3)
                {
                    topo += Helper.NodeAt(member.Value[i], member.Value[i + 1], member.Value[i + 2], Initialiser.Settings.CoincidentNodeAllowance).ToString() + " ";
                }
            }
            ls.Add(topo.TrimEnd());
            ls.Add("0"); // Orientation node
            if (member.Value == null)
            {
                ls.Add("0");
            }
            else
            {
                try
                {
                    ls.Add(Helper.Get1DAngle(member.Value.ToArray(), member.ZAxis ?? new StructuralVectorThree(0, 0, 1)).ToString());
                }
                catch { ls.Add("0"); }
            }
            //ls.Add(member.GSAMeshSize == 0 ? "0" : member.GSAMeshSize.ToString()); // Target mesh size
            ls.Add(member.GSAMeshSize == null ? "0" : member.GSAMeshSize.ToString());           // Target mesh size
            ls.Add("MESH");                                                                     // TODO: What is this?
            ls.Add((member.ElementType == Structural1DElementType.Spring) ? "SPRING" : "BEAM"); // Element type
            ls.Add("0");                                                                        // Fire
            ls.Add("0");                                                                        // Time 1
            ls.Add("0");                                                                        // Time 2
            ls.Add("0");                                                                        // Time 3
            ls.Add("0");                                                                        // Time 4
            ls.Add((member.GSADummy.HasValue && member.GSADummy.Value) ? "DUMMY" : "ACTIVE");

            if (member.EndRelease == null)
            {
                ls.AddRange(new[] { "2", "2" });
            }
            else
            {
                try
                {
                    if (member.EndRelease[0].Value.SequenceEqual(ParseEndReleases(1).Value))
                    {
                        ls.Add("1");
                    }
                    else if (member.EndRelease[0].Value.SequenceEqual(ParseEndReleases(2).Value))
                    {
                        ls.Add("2");
                    }
                    else if (member.EndRelease[0].Value.SequenceEqual(ParseEndReleases(3).Value))
                    {
                        ls.Add("3");
                    }
                    else
                    {
                        if (member.EndRelease[0].Value.Skip(3).Take(3).SequenceEqual(new bool[] { false, false, false }))
                        {
                            ls.Add("2");
                        }
                        else
                        {
                            ls.Add("1");
                        }
                    }
                }
                catch { ls.Add("2"); }

                try
                {
                    if (member.EndRelease[1].Value.SequenceEqual(ParseEndReleases(1).Value))
                    {
                        ls.Add("1");
                    }
                    else if (member.EndRelease[1].Value.SequenceEqual(ParseEndReleases(2).Value))
                    {
                        ls.Add("2");
                    }
                    else if (member.EndRelease[1].Value.SequenceEqual(ParseEndReleases(3).Value))
                    {
                        ls.Add("3");
                    }
                    else
                    {
                        if (member.EndRelease[1].Value.Skip(3).Take(3).SequenceEqual(new bool[] { false, false, false }))
                        {
                            ls.Add("2");
                        }
                        else
                        {
                            ls.Add("1");
                        }
                    }
                }
                catch { ls.Add("2"); }
            }

            ls.Add("AUTOMATIC"); // Effective length option
            ls.Add("0");         // Pool
            ls.Add("0");         // Height
            ls.Add("MAN");       // Auto offset 1
            ls.Add("MAN");       // Auto offset 2
            ls.Add("NO");        // Internal auto offset

            if (member.Offset == null)
            {
                ls.AddRange(new[] { "0", "0", "0", "0" });
            }
            else
            {
                try
                {
                    var subLs = new List <string>
                    {
                        member.Offset[0].Value[0].ToString(), // Offset x-start
                        member.Offset[1].Value[0].ToString(), // Offset x-end

                        member.Offset[0].Value[1].ToString(),
                        member.Offset[0].Value[2].ToString()
                    };

                    ls.AddRange(subLs);
                }
                catch
                {
                    ls.AddRange(new[] { "0", "0", "0", "0" });
                }
            }
            ls.Add("ALL"); // Exposure

            return(string.Join("\t", ls));
        }
Esempio n. 6
0
        public string SetGWACommand(int group = 0)
        {
            if (this.Value == null)
            {
                return("");
            }

            var element = this.Value as Structural1DElement;

            if (element.Value == null || element.Value.Count() == 0)
            {
                return("");
            }

            var keyword = typeof(GSA1DElement).GetGSAKeyword();

            var index = Initialiser.Cache.ResolveIndex(keyword, element.ApplicationId);

            var propKeyword = typeof(GSA1DProperty).GetGSAKeyword();
            var indexResult = Initialiser.Cache.LookupIndex(propKeyword, element.PropertyRef);
            //If the reference can't be found, then reserve a new index so that it at least doesn't point to any other existing record
            var propRef = indexResult ?? Initialiser.Cache.ResolveIndex(propKeyword, element.PropertyRef);

            if (indexResult == null && element.ApplicationId != null)
            {
                if (element.PropertyRef == null)
                {
                    Helper.SafeDisplay("Blank property references found for these Application IDs:", element.ApplicationId);
                }
                else
                {
                    Helper.SafeDisplay("Property references not found:", element.ApplicationId + " referencing " + element.PropertyRef);
                }
            }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + Helper.GenerateSID(element),
                index.ToString(),
                element.Name == null || element.Name == "" ? " " : element.Name,
                "NO_RGB",
                "BEAM", // Type
                propRef.ToString(),
                group.ToString()
            };

            for (var i = 0; i < element.Value.Count(); i += 3)
            {
                ls.Add(Helper.NodeAt(element.Value[i], element.Value[i + 1], element.Value[i + 2], Initialiser.Settings.CoincidentNodeAllowance).ToString());
            }
            ls.Add("0"); // Orientation Node
            try
            {
                ls.Add(Helper.Get1DAngle(element.Value.ToArray(), element.ZAxis).ToString());
            }
            catch { ls.Add("0"); }
            try
            {
                var subLs = new List <string>();
                if (element.EndRelease[0].Value.Any(x => x) || element.EndRelease[1].Value.Any(x => x))
                {
                    subLs.Add("RLS");

                    var end1 = "";

                    end1 += element.EndRelease[0].Value[0] ? "R" : "F";
                    end1 += element.EndRelease[0].Value[1] ? "R" : "F";
                    end1 += element.EndRelease[0].Value[2] ? "R" : "F";
                    end1 += element.EndRelease[0].Value[3] ? "R" : "F";
                    end1 += element.EndRelease[0].Value[4] ? "R" : "F";
                    end1 += element.EndRelease[0].Value[5] ? "R" : "F";

                    subLs.Add(end1);

                    var end2 = "";

                    end2 += element.EndRelease[1].Value[0] ? "R" : "F";
                    end2 += element.EndRelease[1].Value[1] ? "R" : "F";
                    end2 += element.EndRelease[1].Value[2] ? "R" : "F";
                    end2 += element.EndRelease[1].Value[3] ? "R" : "F";
                    end2 += element.EndRelease[1].Value[4] ? "R" : "F";
                    end2 += element.EndRelease[1].Value[5] ? "R" : "F";

                    subLs.Add(end2);

                    ls.AddRange(subLs);
                }
                else
                {
                    ls.Add("NO_RLS");
                }
            }
            catch { ls.Add("NO_RLS"); }

            try
            {
                var subLs = new List <string>
                {
                    element.Offset[0].Value[0].ToString(), // Offset x-start
                    element.Offset[1].Value[0].ToString(), // Offset x-end

                    element.Offset[0].Value[1].ToString(),
                    element.Offset[0].Value[2].ToString()
                };

                ls.AddRange(subLs);
            }
            catch
            {
                ls.Add("0");
                ls.Add("0");
                ls.Add("0");
                ls.Add("0");
            }

            //ls.Add("NORMAL"); // Action // TODO: EL.4 SUPPORT
            ls.Add((element.GSADummy.HasValue && element.GSADummy.Value) ? "DUMMY" : "");

            return(string.Join("\t", ls));
        }