Esempio n. 1
0
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var infl = this.Value as Structural1DInfluenceEffect;

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

            var index = Initialiser.Cache.ResolveIndex(typeof(GSA1DInfluenceEffect).GetGSAKeyword(), infl.ApplicationId);

            var elementRef = Initialiser.Cache.LookupIndex(typeof(GSA1DElement).GetGSAKeyword(), infl.ElementRef);

            if (!elementRef.HasValue)
            {
                return("");
            }

            var direction = new string[6] {
                "X", "Y", "Z", "XX", "YY", "ZZ"
            };

            var gwaCommands = new List <string>();

            for (var i = 0; i < infl.Directions.Value.Count(); i++)
            {
                var ls = new List <string>
                {
                    "SET_AT",
                    index.ToString(),
                    keyword + ":" + HelperClass.GenerateSID(infl),
                    infl.Name == null || infl.Name == "" ? " " : infl.Name,
                    infl.GSAEffectGroup.ToString(),
                    elementRef.Value.ToString(),
                    (infl.Position * 100).ToString() + "%",
                    infl.Factor.ToString()
                };
                switch (infl.EffectType)
                {
                case StructuralInfluenceEffectType.Force:
                    ls.Add("FORCE");
                    break;

                case StructuralInfluenceEffectType.Displacement:
                    ls.Add("DISP");
                    break;

                default:
                    return("");
                }
                ls.Add("GLOBAL"); // TODO: GSA TEAM TO LOOK INTO THIS. GLOBAL IS DEFAULT IN GSA
                ls.Add(direction[i]);
                gwaCommands.Add(string.Join("\t", ls));
            }
            return(string.Join("\n", gwaCommands));
        }
Esempio n. 2
0
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var load = this.Value as Structural0DLoad;

            if (load.Loading == null)
            {
                return("");
            }

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

            var nodeRefs    = Initialiser.Cache.LookupIndices(typeof(GSANode).GetGSAKeyword(), load.NodeRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
            var loadCaseRef = 0;

            try
            {
                loadCaseRef = Initialiser.Cache.LookupIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef).Value;
            }
            catch {
                loadCaseRef = Initialiser.Cache.ResolveIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef);
            }

            var direction = new string[6] {
                "X", "Y", "Z", "XX", "YY", "ZZ"
            };

            var gwaCommands = new List <string>();

            for (var i = 0; i < load.Loading.Value.Count(); i++)
            {
                var ls = new List <string>();

                if (load.Loading.Value[i] == 0)
                {
                    continue;
                }

                var index = Initialiser.Cache.ResolveIndex(typeof(GSA0DLoad).GetGSAKeyword());

                ls.Add("SET_AT");
                ls.Add(index.ToString());
                ls.Add(keyword + ":" + HelperClass.GenerateSID(load));
                ls.Add(load.Name == null || load.Name == "" ? " " : load.Name);
                ls.Add(string.Join(" ", nodeRefs));
                ls.Add(loadCaseRef.ToString());
                ls.Add("GLOBAL"); // Axis
                ls.Add(direction[i]);
                ls.Add(load.Loading.Value[i].ToString());

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

            var mesh = this.Value as Structural2DElement;

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

            var index   = Initialiser.Cache.ResolveIndex(typeof(GSA2DElement).GetGSAKeyword(), mesh.ApplicationId);
            var propRef = 0;

            try
            {
                propRef = Initialiser.Cache.LookupIndex(typeof(GSA2DProperty).GetGSAKeyword(), mesh.PropertyRef).Value;
            }
            catch { }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(mesh),
                index.ToString(),
                mesh.Name == null || mesh.Name == "" ? " " : mesh.Name,
                mesh.Colors == null || mesh.Colors.Count() < 1 ? "NO_RGB" : mesh.Colors[0].ArgbToHexColor().ToString(),
                mesh.Vertices.Count() / 3 == 3 ? "TRI3" : "QUAD4",
                propRef.ToString(),
                group.ToString() // Group
            };
            var numVertices = mesh.Faces[0] + 3;
            var coor        = new List <double>();

            for (var i = 1; i < mesh.Faces.Count(); i++)
            {
                coor.AddRange(mesh.Vertices.Skip(mesh.Faces[i] * 3).Take(3));
                ls.Add(HelperClass.NodeAt(mesh.Vertices[mesh.Faces[i] * 3], mesh.Vertices[mesh.Faces[i] * 3 + 1], mesh.Vertices[mesh.Faces[i] * 3 + 2], Initialiser.Settings.CoincidentNodeAllowance).ToString());
            }
            ls.Add("0"); //Orientation node
            try
            {
                ls.Add(HelperClass.Get2DAngle(coor.ToArray(), mesh.Axis).ToString());
            }
            catch { ls.Add("0"); }
            ls.Add("NO_RLS");

            ls.Add("0"); // Offset x-start
            ls.Add("0"); // Offset x-end
            ls.Add("0"); // Offset y
            ls.Add(mesh.Offset.ToString());

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

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

            var prop = this.Value as Structural1DProperty;

            if (prop.Profile == null && string.IsNullOrEmpty(prop.CatalogueName))
            {
                return("");
            }

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

            var index        = Initialiser.Cache.ResolveIndex(typeof(GSA1DProperty).GetGSAKeyword(), prop.ApplicationId);
            var materialRef  = 0;
            var materialType = "UNDEF";

            var res = Initialiser.Cache.LookupIndex(typeof(GSAMaterialSteel).GetGSAKeyword(), prop.MaterialRef);

            if (res.HasValue)
            {
                materialRef  = res.Value;
                materialType = "STEEL";
            }
            else
            {
                res = Initialiser.Cache.LookupIndex(typeof(GSAMaterialConcrete).GetGSAKeyword(), prop.MaterialRef);
                if (res.HasValue)
                {
                    materialRef  = res.Value;
                    materialType = "CONCRETE";
                }
            }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(prop),
                index.ToString(),
                prop.Name == null || prop.Name == "" ? " " : prop.Name,
                "NO_RGB",
                materialType,
                materialRef.ToString(),
                "0", // Analysis material
                GetGSADesc(prop, GSAUnits),
                "0"  // Cost
            };

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

            var spring = this.Value as Structural0DSpring;

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

            var index   = Initialiser.Cache.ResolveIndex(keyword, spring.ApplicationId);
            var propRef = 0;

            try
            {
                propRef = Initialiser.Cache.LookupIndex(typeof(GSASpringProperty).GetGSAKeyword(), spring.PropertyRef).Value;
            }
            catch { }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(spring),
                index.ToString(),
                spring.Name == null || spring.Name == "" ? " " : spring.Name,
                "NO_RGB",
                "GRD_SPRING",       //type
                propRef.ToString(), //Property
                group.ToString(),   //Group
                //"1", //Group
            };

            //Topology
            for (var i = 0; i < spring.Value.Count(); i += 3)
            {
                ls.Add(HelperClass.NodeAt(spring.Value[i], spring.Value[i + 1], spring.Value[i + 2], Initialiser.Settings.CoincidentNodeAllowance).ToString());
            }

            ls.Add("0");      // Orientation Node
            ls.Add("0");      //Angle
            ls.Add("NO_RLS"); //is_rls

            ls.Add("0");
            ls.Add("0");
            ls.Add("0");
            ls.Add("0");

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

            return(string.Join("\t", ls));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var obj             = this.Value as StructuralStagedNodalRestraints;
            var destinationType = typeof(GSAStructuralStagedNodalRestraints);

            var keyword     = destinationType.GetGSAKeyword();
            var subkeywords = destinationType.GetSubGSAKeyword();

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

            var nodesStr = "none"; //default value

            if (obj.NodeRefs != null && obj.NodeRefs.Count() >= 1)
            {
                var nodeIndices = Initialiser.Cache.LookupIndices(typeof(GSANode).GetGSAKeyword(), obj.NodeRefs);
                nodesStr = string.Join(" ", nodeIndices);
            }

            var stageDefStr = "all"; //default value

            if (obj.ConstructionStageRefs != null && obj.ConstructionStageRefs.Count() >= 1)
            {
                var stageDefIndices = Initialiser.Cache.LookupIndices(typeof(GSAConstructionStage).GetGSAKeyword(), obj.ConstructionStageRefs);
                stageDefStr = string.Join(" ", stageDefIndices);
            }

            var ls = new List <string>
            {
                "SET_AT",
                index.ToString(),
                keyword + ":" + HelperClass.GenerateSID(obj),
                string.IsNullOrEmpty(obj.Name) ? " " : obj.Name
            };

            ls.AddRange(obj.Restraint.Value.Select(v => v ? "1" : "0"));
            ls.Add(nodesStr);
            ls.Add(stageDefStr);

            return(string.Join("\t", ls));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var load = this.Value as StructuralGravityLoading;

            if (load.GravityFactors == null)
            {
                return("");
            }

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

            var loadCaseIndex = 0;

            try
            {
                loadCaseIndex = Initialiser.Cache.LookupIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef).Value;
            }
            catch {
                loadCaseIndex = Initialiser.Cache.ResolveIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef);
            }

            var index = Initialiser.Cache.ResolveIndex(typeof(GSAGravityLoading).GetGSAKeyword());

            var ls = new List <string>
            {
                "SET_AT",
                index.ToString(),
                keyword + ":" + HelperClass.GenerateSID(load),
                string.IsNullOrEmpty(load.Name) ? "" : load.Name,
                "all",
                loadCaseIndex.ToString(),
                load.GravityFactors.Value[0].ToString(),
                load.GravityFactors.Value[1].ToString(),
                load.GravityFactors.Value[2].ToString(),
            };

            return(string.Join("\t", ls));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var destType = typeof(GSABridgeVehicle);

            var vehicle = this.Value as StructuralBridgeVehicle;

            var keyword = destType.GetGSAKeyword();

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

            //The width parameter is intentionally not being used here as the meaning doesn't map to the y coordinate parameter of the ASSEMBLY keyword
            //It is therefore to be ignored here for GSA purposes.

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(vehicle),
                index.ToString(),
                string.IsNullOrEmpty(vehicle.Name) ? "" : vehicle.Name,
                vehicle.Width.ToString(),
                vehicle.Axles.Count().ToString()
            };

            foreach (var axle in vehicle.Axles)
            {
                ls.AddRange(new[] {
                    axle.Position.ToString(),
                    axle.WheelOffset.ToString(),
                    axle.LeftWheelLoad.ToString(),
                    axle.RightWheelLoad.ToString()
                });
            }

            return(string.Join("\t", ls));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var destType = typeof(GSABridgePath);

            var path = this.Value as StructuralBridgePath;

            var keyword = destType.GetGSAKeyword();

            var index          = Initialiser.Cache.ResolveIndex(keyword, path.ApplicationId);
            var alignmentIndex = Initialiser.Cache.LookupIndex(typeof(GSABridgeAlignment).GetGSAKeyword(), path.AlignmentRef) ?? 1;

            var left  = (path.Offsets == null || path.Offsets.Count() == 0) ? 0 : path.Offsets.First();
            var right = (path.PathType == StructuralBridgePathType.Track || path.PathType == StructuralBridgePathType.Vehicle)
        ? path.Gauge
        : (path.Offsets == null || path.Offsets.Count() == 0) ? 0 : path.Offsets.Last();

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(path),
                index.ToString(),
                string.IsNullOrEmpty(path.Name) ? "" : path.Name,
                PathTypeToGWAString(path.PathType),
                "1", //Group
                alignmentIndex.ToString(),
                left.ToString(),
                right.ToString(),
                path.LeftRailFactor.ToString()
            };

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

            var node = this.Value as StructuralNode;

            if (!node.Mass.HasValue || node.Mass == 0)
            {
                return("");
            }

            var keyword   = typeof(GSA0DElement).GetGSAKeyword();
            var index     = Initialiser.Cache.ResolveIndex(typeof(GSA0DElement).GetGSAKeyword(), node.ApplicationId);
            var propIndex = Initialiser.Cache.ResolveIndex("PROP_MASS.2", node.ApplicationId);
            var nodeIndex = Initialiser.Cache.ResolveIndex(typeof(GSANode).GetGSAKeyword(), node.ApplicationId);

            var gwaCommands = new List <string>();

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(node),
                index.ToString(),
                node.Name == null || node.Name == "" ? " " : node.Name,
                "NO_RGB",
                "MASS",
                propIndex.ToString(),
                "0",      // Group
                nodeIndex.ToString(),
                "0",      // Orient Node
                "0",      // Beta
                "NO_RLS", // Release
                "0",      // Offset x-start
                "0",      // Offset y-start
                "0",      // Offset y
                "0",      // Offset z
                ""        //Dummy
            };

            gwaCommands.Add(string.Join("\t", ls));

            ls = new List <string>
            {
                "SET",
                "PROP_MASS.2" + ":" + HelperClass.GenerateSID(node),
                propIndex.ToString(),
                "",
                "NO_RGB",
                "GLOBAL",
                node.Mass.ToString(),
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",

                "MOD",
                "100%",
                "100%",
                "100%"
            };

            gwaCommands.Add(string.Join("\t", ls));

            return(string.Join("\n", gwaCommands));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var loadCombo = this.Value as StructuralLoadCombo;

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

            var index = Initialiser.Cache.ResolveIndex(typeof(GSALoadCombo).GetGSAKeyword(), loadCombo.ApplicationId);

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

            var subLs = new List <string>();

            if (loadCombo.LoadTaskRefs != null)
            {
                for (var i = 0; i < loadCombo.LoadTaskRefs.Count(); i++)
                {
                    var loadTaskRef = Initialiser.Cache.LookupIndex(typeof(GSALoadTask).GetGSAKeyword(), loadCombo.LoadTaskRefs[i]);

                    if (loadTaskRef.HasValue)
                    {
                        subLs.Add((loadCombo.LoadTaskFactors != null && loadCombo.LoadTaskFactors.Count() > i)
              ? loadCombo.LoadTaskFactors[i].ToString() + "A" + loadTaskRef.Value.ToString()
              : "A" + loadTaskRef.Value.ToString());
                    }
                }
            }

            if (loadCombo.LoadComboRefs != null)
            {
                for (var i = 0; i < loadCombo.LoadComboRefs.Count(); i++)
                {
                    var loadComboRef = Initialiser.Cache.LookupIndex(typeof(GSALoadTask).GetGSAKeyword(), loadCombo.LoadComboRefs[i]);

                    if (loadComboRef.HasValue)
                    {
                        subLs.Add((loadCombo.LoadComboFactors != null && loadCombo.LoadComboFactors.Count() > i)
              ? loadCombo.LoadComboFactors[i].ToString() + "C" + loadComboRef.Value.ToString()
              : "C" + loadComboRef.Value.ToString());
                    }
                }
            }

            switch (loadCombo.ComboType)
            {
            case StructuralLoadComboType.LinearAdd:
                ls.Add(string.Join(" + ", subLs));
                break;

            case StructuralLoadComboType.Envelope:
                ls.Add(string.Join(" or ", subLs));
                break;

            default:
                ls.Add(string.Join(" + ", subLs));
                break;
            }

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

            var load = this.Value as Structural2DLoadPanel;

            if (load.Loading == null)
            {
                return("");
            }

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

            //There are no GSA types for these yet so use empty strings for the type names for the index
            var gridSurfaceIndex = Initialiser.Cache.ResolveIndex("GRID_SURFACE.1");
            var gridPlaneIndex   = Initialiser.Cache.ResolveIndex("GRID_PLANE.4");

            var loadCaseIndex = 0;

            try
            {
                loadCaseIndex = Initialiser.Cache.LookupIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef).Value;
            }
            catch { }

            var axis = HelperClass.Parse2DAxis(load.Value.ToArray());

            // Calculate elevation
            var elevation = (load.Value[0] * axis.Normal.Value[0] +
                             load.Value[1] * axis.Normal.Value[1] +
                             load.Value[2] * axis.Normal.Value[2]) /
                            Math.Sqrt(axis.Normal.Value[0] * axis.Normal.Value[0] +
                                      axis.Normal.Value[1] * axis.Normal.Value[1] +
                                      axis.Normal.Value[2] * axis.Normal.Value[2]);

            // Transform coordinate to new axis
            var transformed = HelperClass.MapPointsGlobal2Local(load.Value.ToArray(), axis);

            var ls = new List <string>();

            var direction = new string[3] {
                "X", "Y", "Z"
            };

            var gwaCommands = new List <string>();

            for (var i = 0; i < load.Loading.Value.Count(); i++)
            {
                if (load.Loading.Value[i] == 0)
                {
                    continue;
                }

                var index = Initialiser.Cache.ResolveIndex(typeof(GSAGridAreaLoad).GetGSAKeyword());

                ls.Clear();
                var subLs = new List <string>();
                for (var j = 0; j < transformed.Count(); j += 3)
                {
                    subLs.Add("(" + transformed[j].ToString() + "," + transformed[j + 1].ToString() + ")");
                }

                ls.AddRange(new string[] {
                    "SET_AT",
                    index.ToString(),
                    keyword + ":" + HelperClass.GenerateSID(load),
                    load.Name == null || load.Name == "" ? " " : load.Name,
                    gridSurfaceIndex.ToString(),
                    "POLYGON",
                    string.Join(" ", subLs),
                    loadCaseIndex.ToString(),
                    "GLOBAL",
                    "NO",
                    direction[i],
                    load.Loading.Value[i].ToString()
                });

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

            ls.Clear();
            ls.AddRange(new[] {
                "SET",
                "GRID_SURFACE.1",
                gridSurfaceIndex.ToString(),
                load.Name == null || load.Name == "" ? " " : load.Name,
                gridPlaneIndex.ToString(),
                "2",    // Dimension of elements to target
                "all",  // List of elements to target
                "0.01", // Tolerance
                "ONE",  // Span option
                "0"
            });         // Span angle
            gwaCommands.Add(string.Join("\t", ls));

            ls.Clear();
            HelperClass.SetAxis(axis, out int planeAxisIndex, out string planeAxisGwa, load.Name);
            if (planeAxisGwa.Length > 0)
            {
                gwaCommands.Add(planeAxisGwa);
            }

            ls.AddRange(new[] {
                "SET",
                "GRID_PLANE.4",
                gridPlaneIndex.ToString(),
                load.Name == null || load.Name == "" ? " " : load.Name,
                "GENERAL", // Type
                planeAxisIndex.ToString(),
                elevation.ToString(),
                "0", // Elevation above
                "0"
            });      // Elevation below
            gwaCommands.Add(string.Join("\t", ls));

            return(string.Join("\n", gwaCommands));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var load = this.Value as Structural1DLoad;

            if (load.Loading == null)
            {
                return("");
            }

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

            List <int> elementRefs;
            List <int> groupRefs;

            if (Initialiser.Settings.TargetLayer == GSATargetLayer.Analysis)
            {
                elementRefs = Initialiser.Cache.LookupIndices(typeof(GSA1DElement).GetGSAKeyword(), load.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                groupRefs   = Initialiser.Cache.LookupIndices(typeof(GSA1DElementPolyline).GetGSAKeyword(), load.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
            }
            else if (Initialiser.Settings.TargetLayer == GSATargetLayer.Design)
            {
                elementRefs = new List <int>();
                groupRefs   = Initialiser.Cache.LookupIndices(typeof(GSA1DMember).GetGSAKeyword(), load.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                groupRefs.AddRange(Initialiser.Cache.LookupIndices(typeof(GSA1DElementPolyline).GetGSAKeyword(), load.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList());
            }
            else
            {
                return("");
            }

            var loadCaseRef = 0;

            try
            {
                loadCaseRef = Initialiser.Cache.LookupIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef).Value;
            }
            catch {
                loadCaseRef = Initialiser.Cache.LookupIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef).Value;
            }

            var direction = new string[6] {
                "X", "Y", "Z", "XX", "YY", "ZZ"
            };

            var gwaCommands = new List <string>();

            for (var i = 0; i < load.Loading.Value.Count(); i++)
            {
                var ls = new List <string>();

                if (load.Loading.Value[i] == 0)
                {
                    continue;
                }

                var index = Initialiser.Cache.ResolveIndex(typeof(GSA1DLoad).GetGSAKeyword());

                ls.Add("SET_AT");
                ls.Add(index.ToString());
                ls.Add("LOAD_BEAM_UDL" + ":" + HelperClass.GenerateSID(load)); // TODO: Only writes to UDL load
                ls.Add(load.Name == null || load.Name == "" ? " " : load.Name);
                // TODO: This is a hack.
                ls.Add(string.Join(" ", elementRefs.Select(x => x.ToString()).Concat(groupRefs.Select(x => "G" + x.ToString()))));
                ls.Add(loadCaseRef.ToString());
                ls.Add("GLOBAL"); // Axis
                ls.Add("NO");     // Projected
                ls.Add(direction[i]);
                ls.Add(load.Loading.Value[i].ToString());

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

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

            var member = this.Value as Structural1DElement;

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

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

            try
            {
                propRef = (member.ElementType == Structural1DElementType.Spring)
          ? Initialiser.Cache.LookupIndex(typeof(GSASpringProperty).GetGSAKeyword(), member.PropertyRef).Value
          : Initialiser.Cache.LookupIndex(typeof(GSA1DProperty).GetGSAKeyword(), member.PropertyRef).Value;
            }
            catch { }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.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 = "";

            for (var i = 0; i < member.Value.Count(); i += 3)
            {
                topo += HelperClass.NodeAt(member.Value[i], member.Value[i + 1], member.Value[i + 2], Initialiser.Settings.CoincidentNodeAllowance).ToString() + " ";
            }
            ls.Add(topo);
            ls.Add("0"); // Orientation node
            try
            {
                ls.Add(HelperClass.Get1DAngle(member.Value.ToArray(), member.ZAxis).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");

            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

            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.Add("0");
                ls.Add("0");
                ls.Add("0");
                ls.Add("0");
            }
            ls.Add("ALL"); // Exposure

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

            var infl = this.Value as StructuralNodalInfluenceEffect;

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

            var index = Initialiser.Cache.ResolveIndex(typeof(GSANodalInfluenceEffect).GetGSAKeyword(), infl.ApplicationId);

            var nodeRef = Initialiser.Cache.LookupIndex(typeof(GSANode).GetGSAKeyword(), infl.NodeRef);

            if (!nodeRef.HasValue)
            {
                return("");
            }

            var gwaCommands = new List <string>();

            HelperClass.SetAxis(infl.Axis, out var axisIndex, out var axisGwa, infl.Name);
            if (axisGwa.Length > 0)
            {
                gwaCommands.Add(axisGwa);
            }

            var direction = new string[6] {
                "X", "Y", "Z", "XX", "YY", "ZZ"
            };

            for (var i = 0; i < infl.Directions.Value.Count(); i++)
            {
                var ls = new List <string>
                {
                    "SET_AT",
                    index.ToString(),
                    keyword + ":" + HelperClass.GenerateSID(infl),
                    infl.Name == null || infl.Name == "" ? " " : infl.Name,
                    infl.GSAEffectGroup.ToString(),
                    nodeRef.Value.ToString(),
                    infl.Factor.ToString()
                };
                switch (infl.EffectType)
                {
                case StructuralInfluenceEffectType.Force:
                    ls.Add("FORCE");
                    break;

                case StructuralInfluenceEffectType.Displacement:
                    ls.Add("DISP");
                    break;

                default:
                    return("");
                }
                ls.Add(axisIndex.ToString());
                ls.Add(direction[i]);
                gwaCommands.Add(string.Join("\t", ls));
            }
            return(string.Join("\n", gwaCommands));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var prop = this.Value as Structural2DProperty;

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

            var index        = Initialiser.Cache.ResolveIndex(typeof(GSA2DProperty).GetGSAKeyword(), prop.ApplicationId);
            var materialRef  = 0;
            var materialType = "UNDEF";

            var res = Initialiser.Cache.LookupIndex(typeof(GSAMaterialSteel).GetGSAKeyword(), prop.MaterialRef);

            if (res.HasValue)
            {
                materialRef  = res.Value;
                materialType = "STEEL";
            }
            else
            {
                res = Initialiser.Cache.LookupIndex(typeof(GSAMaterialConcrete).GetGSAKeyword(), prop.MaterialRef);
                if (res.HasValue)
                {
                    materialRef  = res.Value;
                    materialType = "CONCRETE";
                }
            }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(prop),
                index.ToString(),
                prop.Name == null || prop.Name == "" ? " " : prop.Name,
                "NO_RGB",
                "SHELL",
                "GLOBAL",
                "0", // Analysis material
                materialType,
                materialRef.ToString(),
                "0", // Design
                prop.Thickness.ToString()
            };

            switch (prop.ReferenceSurface)
            {
            case Structural2DPropertyReferenceSurface.Middle:
                ls.Add("CENTROID");
                break;

            case Structural2DPropertyReferenceSurface.Top:
                ls.Add("TOP_CENTRE");
                break;

            case Structural2DPropertyReferenceSurface.Bottom:
                ls.Add("BOT_CENTRE");
                break;

            default:
                ls.Add("CENTROID");
                break;
            }
            ls.Add("0");      // Ref_z
            ls.Add("0");      // Mass
            ls.Add("100%");   // Flex modifier
            ls.Add("100%");   // Shear modifier
            ls.Add("100%");   // Inplane modifier
            ls.Add("100%");   // Weight modifier
            ls.Add("NO_ENV"); // Environmental data

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

            var stageDef = this.Value as StructuralConstructionStage;

            var sourceType = stageDef.Type;

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

            var index = Initialiser.Cache.ResolveIndex(typeof(GSAConstructionStage).GetGSAKeyword(), stageDef.ApplicationId);

            var targetString = " ";

            if (stageDef.ElementRefs != null && stageDef.ElementRefs.Count() > 0)
            {
                if (Initialiser.Settings.TargetLayer == GSATargetLayer.Analysis)
                {
                    var e1DIndices     = Initialiser.Cache.LookupIndices(typeof(GSA1DElement).GetGSAKeyword(), stageDef.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    var e1DPolyIndices = Initialiser.Cache.LookupIndices(typeof(GSA1DElementPolyline).GetGSAKeyword(), stageDef.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    var e2DIndices     = Initialiser.Cache.LookupIndices(typeof(GSA2DElement).GetGSAKeyword(), stageDef.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    var e2DMeshIndices = Initialiser.Cache.LookupIndices(typeof(GSA2DElementMesh).GetGSAKeyword(), stageDef.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();

                    var indices = new List <int>(e1DIndices);
                    indices.AddRange(e1DPolyIndices);
                    indices.AddRange(e2DIndices);
                    indices.AddRange(e2DMeshIndices);
                    indices = indices.Distinct().ToList();

                    targetString = string.Join(" ", indices.Select(x => x.ToString()));
                }
                else if (Initialiser.Settings.TargetLayer == GSATargetLayer.Design)
                {
                    var m1DIndices = Initialiser.Cache.LookupIndices(typeof(GSA1DMember).GetGSAKeyword(), stageDef.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    var m2DIndices = Initialiser.Cache.LookupIndices(typeof(GSA2DMember).GetGSAKeyword(), stageDef.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();

                    var indices = new List <int>(m1DIndices);
                    indices.AddRange(m2DIndices);
                    indices = indices.Distinct().ToList();

                    targetString = string.Join(" ", indices.Select(i => "G" + i.ToString()));
                }
            }

            var stageName = string.IsNullOrEmpty(stageDef.Name) ? " " : stageDef.Name;

            var ls = new List <string>
            {
                // Set ANAL_STAGE
                "SET",
                keyword + ":" + HelperClass.GenerateSID(stageDef),
                index.ToString(),
                stageName,                    // Name
                "NO_RGB",                     // Colour
                targetString,                 //Elements by group name
                "0",                          //Creep factor
                stageDef.StageDays.ToString() // Stage
            };

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

            var mat = this.Value as StructuralMaterialSteel;

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

            var index = Initialiser.Cache.ResolveIndex(typeof(GSAMaterialSteel).GetGSAKeyword(), mat.ApplicationId);

            // TODO: This function barely works.
            var ls = new List <string>
            {
                "SET",
                "MAT_STEEL.3" + ":" + HelperClass.GenerateSID(mat),
                index.ToString(),
                "MAT.8",
                mat.Name == null || mat.Name == "" ? " " : mat.Name,
                "YES",                                // Unlocked
                mat.YoungsModulus.ToString(),         // E
                mat.PoissonsRatio.ToString(),         // nu
                mat.ShearModulus.ToString(),          // G
                mat.Density.ToString(),               // rho
                mat.CoeffThermalExpansion.ToString(), // alpha
                "MAT_ANAL.1",
                "Steel",
                "-268435456",                         // TODO: What is this?
                "MAT_ELAS_ISO",
                "6",                                  // TODO: What is this?
                mat.YoungsModulus.ToString(),         // E
                mat.PoissonsRatio.ToString(),         // nu
                mat.Density.ToString(),               // rho
                mat.CoeffThermalExpansion.ToString(), // alpha
                mat.ShearModulus.ToString(),          // G
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                mat.MaxStrain.ToString(),             // Ultimate strain
                "MAT_CURVE_PARAM.2",
                "",
                "UNDEF",
                "1", // Material factor on strength
                "1", // Material factor on elastic modulus
                "MAT_CURVE_PARAM.2",
                "",
                "UNDEF",
                "1",                             // Material factor on strength
                "1",                             // Material factor on elastic modulus
                "0",                             // Cost
                mat.YieldStrength.ToString(),    // Yield strength
                mat.UltimateStrength.ToString(), // Ultimate strength
                "0",                             // Perfectly plastic strain limit
                "0"                              // Hardening modulus
            };

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

            var mat = this.Value as StructuralMaterialConcrete;

            var keyword = typeof(GSAMaterialConcrete).GetGSAKeyword();
            var index   = Initialiser.Cache.ResolveIndex(typeof(GSAMaterialConcrete).GetGSAKeyword(), mat.ApplicationId);

            // TODO: This function barely works.
            var ls = new List <string>
            {
                "SET",
                "MAT_CONCRETE.17" + ":" + HelperClass.GenerateSID(mat),
                index.ToString(),
                "MAT.8",
                mat.Name == null || mat.Name == "" ? " " : mat.Name,
                "YES",                                // Unlocked
                mat.YoungsModulus.ToString(),         // E
                mat.PoissonsRatio.ToString(),         // nu
                mat.ShearModulus.ToString(),          // G
                mat.Density.ToString(),               // rho
                mat.CoeffThermalExpansion.ToString(), // alpha
                "MAT_ANAL.1",
                "Concrete",
                "-268435456",                         // TODO: What is this?
                "MAT_ELAS_ISO",
                "6",                                  // TODO: What is this?
                mat.YoungsModulus.ToString(),         // E
                mat.PoissonsRatio.ToString(),         // nu
                mat.Density.ToString(),               // rho
                mat.CoeffThermalExpansion.ToString(), // alpha
                mat.ShearModulus.ToString(),          // G
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // TODO: What is this?
                "0",                                  // Ultimate strain
                "MAT_CURVE_PARAM.2",
                "",
                "UNDEF",
                "1", // Material factor on strength
                "1", // Material factor on elastic modulus
                "MAT_CURVE_PARAM.2",
                "",
                "UNDEF",
                "1",                                // Material factor on strength
                "1",                                // Material factor on elastic modulus
                "0",                                // Cost
                "CYLINDER",                         // Strength type
                "N",                                // Cement class
                mat.CompressiveStrength.ToString(), // Concrete strength
                "0",                                //ls.Add("27912500"); // Uncracked strength
                "0",                                //ls.Add("17500000"); // Cracked strength
                "0",                                //ls.Add("2366431"); // Tensile strength
                "0",                                //ls.Add("2366431"); // Peak strength for curves
                "0",                                // TODO: What is this?
                "1",                                // Ratio of initial elastic modulus to secant modulus
                "2",                                // Parabolic coefficient
                "0.00218389285990043",              // SLS strain at peak stress
                "0.0035",                           // SLS max strain
                "0.00041125",                       // ULS strain at plateau stress
                mat.MaxStrain.ToString(),           // ULS max compressive strain
                "0.0035",                           // TODO: What is this?
                "0.002",                            // Plateau strain
                "0.0035",                           // Max axial strain
                "NO",                               // Lightweight?
                mat.AggragateSize.ToString(),       // Aggragate size
                "0",                                // TODO: What is this?
                "1",                                // TODO: What is this?
                "0.8825",                           // Constant stress depth
                "0",                                // TODO: What is this?
                "0",                                // TODO: What is this?
                "0",                                // TODO: What is this?
                "0",                                // TODO: What is this?
                "0"                                 // TODO: What is this?
            };

            return(string.Join("\t", ls));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var loading = this.Value as Structural2DThermalLoad;

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

            var index = Initialiser.Cache.ResolveIndex(typeof(GSA2DThermalLoading).GetGSAKeyword(), loading.ApplicationId);

            var targetString = " ";

            if (loading.ElementRefs != null && loading.ElementRefs.Count() > 0)
            {
                if (Initialiser.Settings.TargetLayer == GSATargetLayer.Analysis)
                {
                    var e2DIndices     = Initialiser.Cache.LookupIndices(typeof(GSA2DElement).GetGSAKeyword(), loading.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    var e2DMeshIndices = Initialiser.Cache.LookupIndices(typeof(GSA2DElementMesh).GetGSAKeyword(), loading.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    targetString = string.Join(" ",
                                               e2DIndices.Select(x => x.ToString())
                                               .Concat(e2DMeshIndices.Select(x => "G" + x.ToString()))
                                               );
                }
                else if (Initialiser.Settings.TargetLayer == GSATargetLayer.Design)
                {
                    var m2DIndices = Initialiser.Cache.LookupIndices(typeof(GSA2DMember).GetGSAKeyword(), loading.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    targetString = string.Join(" ",
                                               m2DIndices.Select(x => "G" + x.ToString()));
                }
            }

            var loadCaseRef = Initialiser.Cache.LookupIndex(typeof(GSALoadCase).GetGSAKeyword(), loading.LoadCaseRef);

            var loadingName = string.IsNullOrEmpty(loading.Name) ? " " : loading.Name;

            var ls = new List <string>
            {
                "SET_AT",
                index.ToString(),
                keyword + ":" + HelperClass.GenerateSID(loading),
                loadingName,  // Name
                targetString, //Elements
                (loadCaseRef.HasValue) ? loadCaseRef.Value.ToString() : "1",
            };

            if (loading.TopTemperature == loading.BottomTemperature)
            {
                ls.Add("CONS");
                ls.Add(loading.TopTemperature.ToString());
            }
            else
            {
                ls.Add("DZ");
                ls.Add(loading.TopTemperature.ToString());
                ls.Add(loading.BottomTemperature.ToString());
            }

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

            var destType = typeof(GSAAssembly);

            var assembly = this.Value as StructuralAssembly;

            var keyword = destType.GetGSAKeyword();

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

            var targetString = " ";

            if (assembly.ElementRefs != null && assembly.ElementRefs.Count() > 0)
            {
                var polylineIndices = Initialiser.Cache.LookupIndices(typeof(GSA1DElementPolyline).GetGSAKeyword(), assembly.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                if (Initialiser.Settings.TargetLayer == GSATargetLayer.Analysis)
                {
                    var e1DIndices     = Initialiser.Cache.LookupIndices(typeof(GSA1DElement).GetGSAKeyword(), assembly.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    var e2DIndices     = Initialiser.Cache.LookupIndices(typeof(GSA2DElement).GetGSAKeyword(), assembly.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    var e2DMeshIndices = Initialiser.Cache.LookupIndices(typeof(GSA2DElementMesh).GetGSAKeyword(), assembly.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();

                    var indices = new List <int>(e1DIndices);
                    indices.AddRange(e2DIndices);
                    indices.AddRange(e2DMeshIndices);
                    indices = indices.Distinct().ToList();

                    targetString = string.Join(" ", indices.Select(x => x.ToString()));
                }
                else if (Initialiser.Settings.TargetLayer == GSATargetLayer.Design)
                {
                    var m1DIndices = Initialiser.Cache.LookupIndices(typeof(GSA1DMember).GetGSAKeyword(), assembly.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                    var m2DIndices = Initialiser.Cache.LookupIndices(typeof(GSA2DMember).GetGSAKeyword(), assembly.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();

                    var indices = new List <int>(m1DIndices);
                    indices.AddRange(m2DIndices);
                    indices = indices.Distinct().ToList();

                    // TODO: Once assemblies can properly target members, this should target members explicitly
                    targetString = string.Join(" ", indices.Select(i => "G" + i.ToString()));
                }
            }

            var nodeIndices = new List <int>();

            for (var i = 0; i < assembly.Value.Count(); i += 3)
            {
                nodeIndices.Add(HelperClass.NodeAt(assembly.Value[i], assembly.Value[i + 1], assembly.Value[i + 2], Initialiser.Settings.CoincidentNodeAllowance));
            }

            var numPoints = (assembly.NumPoints == 0) ? 10 : assembly.NumPoints;

            //The width parameter is intentionally not being used here as the meaning doesn't map to the y coordinate parameter of the ASSEMBLY keyword
            //It is therefore to be ignored here for GSA purposes.

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(assembly),
                index.ToString(),
                string.IsNullOrEmpty(assembly.Name) ? "" : assembly.Name,
                // TODO: Once assemblies can properly target members, this should target members explicitly
                //Initialiser.Settings.TargetLayer == GSATargetLayer.Analysis ? "ELEMENT" : "MEMBER",
                "ELEMENT",
                targetString,
                nodeIndices[0].ToString(),
                nodeIndices[1].ToString(),
                HelperClass.NodeAt(assembly.OrientationPoint.Value[0], assembly.OrientationPoint.Value[1], assembly.OrientationPoint.Value[2], Initialiser.Settings.CoincidentNodeAllowance).ToString(),
                "",                        //Empty list for int_topo as it assumed that the line is never curved
                assembly.Width.ToString(), //Y
                "0",                       //Z
                "LAGRANGE",
                "0",                       //Curve order - reserved for future use according to the documentation
                "POINTS",
                numPoints.ToString()       //Number of points
            };

            return(string.Join("\t", ls));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var load = this.Value as Structural2DLoad;

            if (load.Loading == null)
            {
                return("");
            }

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

            List <int> elementRefs;
            List <int> groupRefs;

            if (Initialiser.Settings.TargetLayer == GSATargetLayer.Analysis)
            {
                elementRefs = Initialiser.Cache.LookupIndices(typeof(GSA2DElement).GetGSAKeyword(), load.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
                groupRefs   = Initialiser.Cache.LookupIndices(typeof(GSA2DElementMesh).GetGSAKeyword(), load.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
            }
            else if (Initialiser.Settings.TargetLayer == GSATargetLayer.Design)
            {
                elementRefs = new List <int>();
                groupRefs   = Initialiser.Cache.LookupIndices(typeof(GSA2DMember).GetGSAKeyword(), load.ElementRefs).Where(x => x.HasValue).Select(x => x.Value).ToList();
            }
            else
            {
                return("");
            }

            var loadCaseRef = 0;

            try
            {
                loadCaseRef = Initialiser.Cache.LookupIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef).Value;
            }
            catch {
                loadCaseRef = Initialiser.Cache.ResolveIndex(typeof(GSALoadCase).GetGSAKeyword(), load.LoadCaseRef);
            }

            var direction = new string[3] {
                "X", "Y", "Z"
            };

            var gwaCommands = new List <string>();

            for (var i = 0; i < load.Loading.Value.Count(); i++)
            {
                if (load.Loading.Value[i] == 0)
                {
                    continue;
                }

                var index = Initialiser.Cache.ResolveIndex(typeof(GSA2DLoad).GetGSAKeyword());

                var ls = new List <string>
                {
                    "SET_AT",
                    index.ToString(),
                    keyword + ":" + HelperClass.GenerateSID(load),
                    load.Name == null || load.Name == "" ? " " : load.Name,
                    // TODO: This is a hack.
                    string.Join(" ", elementRefs.Select(x => x.ToString()).Concat(groupRefs.Select(x => "G" + x.ToString()))),
                    loadCaseRef.ToString(),
                    load.AxisType == StructuralLoadAxisType.Local ? "LOCAL" : "GLOBAL", // Axis
                    "CONS",                                                             // Type
                    "NO",                                                               // Projected
                    direction[i],
                    load.Loading.Value[i].ToString()
                };

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

            return(string.Join("\n", gwaCommands));
        }
Esempio n. 23
0
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var node = this.Value as StructuralNode;

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

            var index = HelperClass.NodeAt(node.Value[0], node.Value[1], node.Value[2], Initialiser.Settings.CoincidentNodeAllowance);

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(node),
                index.ToString(),
                node.Name == null || node.Name == "" ? " " : node.Name,
                "NO_RGB",
                string.Join("\t", node.Value.ToArray()),

                //ls.Add("0"); // TODO: Skip unknown fields in NODE.3
                //ls.Add("0"); // TODO: Skip unknown fields in NODE.3
                //ls.Add("0"); // TODO: Skip unknown fields in NODE.3

                "NO_GRID"
            };


            var gwaCommands = new List <string>();
            var axisGwa     = "";

            try
            {
                HelperClass.SetAxis(node.Axis, out var axisIndex, out axisGwa, node.Name);
                if (axisGwa.Length > 0)
                {
                    gwaCommands.Add(axisGwa);
                }

                ls.Add(axisIndex.ToString());
            }
            catch { ls.Add("0"); }

            try
            {
                if (node.Restraint == null || !node.Restraint.Value.Any(x => x))
                {
                    ls.Add("NO_REST");
                }
                else
                {
                    var subLs = new List <string>
                    {
                        "REST",
                        node.Restraint.Value[0] ? "1" : "0",
                        node.Restraint.Value[1] ? "1" : "0",
                        node.Restraint.Value[2] ? "1" : "0",
                        node.Restraint.Value[3] ? "1" : "0",
                        node.Restraint.Value[4] ? "1" : "0",
                        node.Restraint.Value[5] ? "1" : "0"
                    };
                    ls.AddRange(subLs);
                }
            }
            catch { ls.Add("NO_REST"); }

            try
            {
                if (node.Stiffness == null || !node.Stiffness.Value.Any(x => x == 0))
                {
                    ls.Add("NO_STIFF");
                }
                else
                {
                    var subLs = new List <string>
                    {
                        "STIFF",
                        node.Stiffness.Value[0].ToString(),
                        node.Stiffness.Value[1].ToString(),
                        node.Stiffness.Value[2].ToString(),
                        node.Stiffness.Value[3].ToString(),
                        node.Stiffness.Value[4].ToString(),
                        node.Stiffness.Value[5].ToString()
                    };
                    ls.AddRange(subLs);
                }
            }
            catch { ls.Add("NO_STIFF"); }

            try
            {
                if (node.GSALocalMeshSize == 0)
                {
                    ls.Add("NO_MESH");
                }
                else
                {
                    var subLs = new List <string>
                    {
                        "MESH",
                        node.GSALocalMeshSize.ToString(),
                        "0",  // Radius
                        "NO", // Tie to mesh
                        "NO", // column rigidity will be generated
                        "0",  // Column property number
                        "0",  //Column orientation node
                        "0",  //Column orientation angle
                        "1",  //Column dimension factor
                        "0"   //Column slab thickness factor
                    };

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

            gwaCommands.Add(string.Join("\t", ls));

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

            var element = this.Value as Structural1DElement;

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

            var index   = Initialiser.Cache.ResolveIndex(typeof(GSA1DElement).GetGSAKeyword(), element.ApplicationId);
            var propRef = 0;

            try
            {
                propRef = Initialiser.Cache.LookupIndex(typeof(GSA1DProperty).GetGSAKeyword(), element.PropertyRef).Value;
            }
            catch { }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.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(HelperClass.NodeAt(element.Value[i], element.Value[i + 1], element.Value[i + 2], Initialiser.Settings.CoincidentNodeAllowance).ToString());
            }
            ls.Add("0"); // Orientation Node
            try
            {
                ls.Add(HelperClass.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));
        }
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var loadCase = this.Value as StructuralLoadCase;

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

            var index = Initialiser.Cache.ResolveIndex(typeof(GSALoadCase).GetGSAKeyword(), loadCase.ApplicationId);

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

            switch (loadCase.CaseType)
            {
            case StructuralLoadCaseType.Dead:
                ls.Add("DEAD");
                break;

            case StructuralLoadCaseType.Live:
                ls.Add("LC_VAR_IMP");
                break;

            case StructuralLoadCaseType.Wind:
                ls.Add("WIND");
                break;

            case StructuralLoadCaseType.Snow:
                ls.Add("SNOW");
                break;

            case StructuralLoadCaseType.Earthquake:
                ls.Add("SEISMIC");
                break;

            case StructuralLoadCaseType.Soil:
                ls.Add("LC_PERM_SOIL");
                break;

            case StructuralLoadCaseType.Thermal:
                ls.Add("LC_VAR_TEMP");
                break;

            default:
                ls.Add("LC_UNDEF");
                break;
            }
            ls.Add("1");        // Source
            ls.Add("~");        // Category
            ls.Add("NONE");     // Direction
            ls.Add("INC_BOTH"); // Include

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

            var mesh = this.Value as Structural2DElementMesh;

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

            var index   = Initialiser.Cache.ResolveIndex(typeof(GSA2DMember).GetGSAKeyword(), mesh.ApplicationId);
            var propRef = 0;

            try
            {
                propRef = Initialiser.Cache.LookupIndex(typeof(GSA2DProperty).GetGSAKeyword(), mesh.PropertyRef).Value;
            }
            catch { }

            var gwaCommands = new List <string>();

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(mesh),
                index.ToString(),
                mesh.Name == null || mesh.Name == "" ? " " : mesh.Name,
                mesh.Colors == null || mesh.Colors.Count() < 1 ? "NO_RGB" : mesh.Colors[0].ArgbToHexColor().ToString()
            };

            if (mesh.ElementType == Structural2DElementType.Slab)
            {
                ls.Add("SLAB");
            }
            else if (mesh.ElementType == Structural2DElementType.Wall)
            {
                ls.Add("WALL");
            }
            else
            {
                ls.Add("2D_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           = "";
            var prevNodeIndex  = -1;
            var connectivities = mesh.Edges();
            var coor           = new List <double>();

            foreach (var c in connectivities[0])
            {
                coor.AddRange(mesh.Vertices.Skip(c * 3).Take(3));
                var currIndex = HelperClass.NodeAt(mesh.Vertices[c * 3], mesh.Vertices[c * 3 + 1], mesh.Vertices[c * 3 + 2], Initialiser.Settings.CoincidentNodeAllowance);
                if (prevNodeIndex != currIndex)
                {
                    topo += currIndex.ToString() + " ";
                }
                prevNodeIndex = currIndex;
            }
            ls.Add(topo.Trim());
            ls.Add("0"); // Orientation node
            try
            {
                ls.Add(HelperClass.Get2DAngle(coor.ToArray(), mesh.Axis.First()).ToString());
            }
            catch { ls.Add("0"); }
            ls.Add(mesh.GSAMeshSize == 0 ? "1" : mesh.GSAMeshSize.ToString());                               // Target mesh size
            ls.Add("MESH");                                                                                  // TODO: What is this?
            ls.Add("LINEAR");                                                                                // Element type
            ls.Add("0");                                                                                     // Fire
            ls.Add("0");                                                                                     // Time 1
            ls.Add("0");                                                                                     // Time 2
            ls.Add("0");                                                                                     // Time 3
            ls.Add("0");                                                                                     // TODO: What is this?
            ls.Add((mesh.GSADummy.HasValue && mesh.GSADummy.Value) ? "DUMMY" : "ACTIVE");
            ls.Add("NO");                                                                                    // Internal auto offset
            ls.Add((mesh.Offset != null && mesh.Offset.Count() > 0) ? mesh.Offset.First().ToString() : "0"); // Offset z
            ls.Add("ALL");                                                                                   // Exposure

            gwaCommands.Add(string.Join("\t", ls));

            // Add voids
            foreach (var conn in connectivities.Skip(1))
            {
                ls.Clear();

                index = Initialiser.Cache.ResolveIndex(typeof(GSA2DVoid).GetGSAKeyword());

                ls.Add("SET");
                ls.Add(keyword + ":" + HelperClass.GenerateSID(mesh));
                ls.Add(index.ToString());
                ls.Add(mesh.Name == null || mesh.Name == "" ? " " : mesh.Name);
                ls.Add(mesh.Colors == null || mesh.Colors.Count() < 1 ? "NO_RGB" : mesh.Colors[0].ArgbToHexColor().ToString());
                ls.Add("2D_VOID_CUTTER");
                ls.Add("1"); // Property reference
                ls.Add("0"); // Group
                topo          = "";
                prevNodeIndex = -1;
                coor.Clear();
                foreach (var c in conn)
                {
                    coor.AddRange(mesh.Vertices.Skip(c * 3).Take(3));
                    var currIndex = HelperClass.NodeAt(mesh.Vertices[c * 3], mesh.Vertices[c * 3 + 1], mesh.Vertices[c * 3 + 2], Initialiser.Settings.CoincidentNodeAllowance);
                    if (prevNodeIndex != currIndex)
                    {
                        topo += currIndex.ToString() + " ";
                    }
                    prevNodeIndex = currIndex;
                }
                ls.Add(topo);
                ls.Add("0");      // Orientation node
                ls.Add("0");      // Angles
                ls.Add("1");      // Target mesh size
                ls.Add("MESH");   // TODO: What is this?
                ls.Add("LINEAR"); // Element type
                ls.Add("0");      // Fire
                ls.Add("0");      // Time 1
                ls.Add("0");      // Time 2
                ls.Add("0");      // Time 3
                ls.Add("0");      // TODO: What is this?
                ls.Add("ACTIVE"); // Dummy
                ls.Add("NO");     // Internal auto offset
                ls.Add("0");      // Offset z
                ls.Add("ALL");    // Exposure

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

            var constraint = this.Value as StructuralRigidConstraints;

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

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

            var slaveNodeIndices        = Initialiser.Cache.LookupIndices(typeof(GSANode).GetGSAKeyword(), constraint.NodeRefs).Where(x => x.HasValue).Select(x => x.Value.ToString()).ToList();
            var slaveNodeIndicesSummary = slaveNodeIndices.Count > 0 ? string.Join(" ", slaveNodeIndices) : "none";
            var masterNodeIndex         = Initialiser.Cache.LookupIndex(typeof(GSANode).GetGSAKeyword(), constraint.MasterNodeRef);
            var stageDefRefs            = Initialiser.Cache.LookupIndices(typeof(GSAConstructionStage).GetGSAKeyword(), constraint.ConstructionStageRefs).Where(x => x.HasValue).Select(x => x.Value.ToString()).ToList();

            var subLs = new List <string>();

            if (constraint.Constraint.Value[0])
            {
                var x = "X:X";
                if (constraint.Constraint.Value[4])
                {
                    x += "YY";
                }
                if (constraint.Constraint.Value[5])
                {
                    x += "ZZ";
                }
                subLs.Add(x);
            }

            if (constraint.Constraint.Value[1])
            {
                var y = "Y:Y";
                if (constraint.Constraint.Value[3])
                {
                    y += "XX";
                }
                if (constraint.Constraint.Value[5])
                {
                    y += "ZZ";
                }
                subLs.Add(y);
            }

            if (constraint.Constraint.Value[2])
            {
                var z = "Z:Z";
                if (constraint.Constraint.Value[3])
                {
                    z += "XX";
                }
                if (constraint.Constraint.Value[4])
                {
                    z += "YY";
                }
                subLs.Add(z);
            }

            if (constraint.Constraint.Value[3])
            {
                subLs.Add("XX:XX");
            }

            if (constraint.Constraint.Value[4])
            {
                subLs.Add("YY:YY");
            }

            if (constraint.Constraint.Value[5])
            {
                subLs.Add("ZZ:ZZ");
            }

            var ls = new List <string>
            {
                "SET_AT",
                index.ToString(),
                keyword + ":" + HelperClass.GenerateSID(constraint),
                constraint.Name == null || constraint.Name == "" ? " " : constraint.Name,
                (masterNodeIndex.HasValue) ? masterNodeIndex.Value.ToString() : "0", // Master node
                string.Join("-", subLs),
                string.Join(" ", slaveNodeIndices),
                string.Join(" ", stageDefRefs),
                "0" // Parent member
            };

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

            var v = this.Value as Structural2DVoid;

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

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

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(v),
                index.ToString(),
                v.Name == null || v.Name == "" ? " " : v.Name,
                v.Colors == null || v.Colors.Count() < 1 ? "NO_RGB" : v.Colors[0].ArgbToHexColor().ToString(),
                "2D_VOID_CUTTER",
                "1", // Property reference
                "0"  // Group
            };
            var topo           = "";
            var prevNodeIndex  = -1;
            var connectivities = v.Edges();
            var coor           = new List <double>();

            if (connectivities.Count == 0)
            {
                return("");
            }

            foreach (var c in connectivities[0])
            {
                coor.AddRange(v.Vertices.Skip(c * 3).Take(3));
                var currIndex = HelperClass.NodeAt(v.Vertices[c * 3], v.Vertices[c * 3 + 1], v.Vertices[c * 3 + 2], Initialiser.Settings.CoincidentNodeAllowance);
                if (prevNodeIndex != currIndex)
                {
                    topo += currIndex.ToString() + " ";
                }
                prevNodeIndex = currIndex;
            }

            ls.Add(topo);
            ls.Add("0");      // Orientation node
            ls.Add("0");      // Angles
            ls.Add("1");      // Target mesh size
            ls.Add("MESH");   // TODO: What is this?
            ls.Add("LINEAR"); // Element type
            ls.Add("0");      // Fire
            ls.Add("0");      // Time 1
            ls.Add("0");      // Time 2
            ls.Add("0");      // Time 3
            ls.Add("0");      // TODO: What is this?
            ls.Add("ACTIVE"); // Dummy
            ls.Add("NO");     // Internal auto offset
            ls.Add("0");      // Offset z
            ls.Add("ALL");    // Exposure

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

            var loadTask = this.Value as StructuralLoadTask;

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

            var taskIndex = Initialiser.Cache.ResolveIndex("TASK.1", loadTask.ApplicationId);
            var index     = Initialiser.Cache.ResolveIndex(typeof(GSALoadTask).GetGSAKeyword(), loadTask.ApplicationId);

            var gwaCommands = new List <string>();

            var ls = new List <string>
            {
                // Set TASK
                "SET",
                "TASK.1" + ":" + HelperClass.GenerateSID(loadTask),
                taskIndex.ToString(),
                "", // Name
                "0" // Stage
            };

            switch (loadTask.TaskType)
            {
            case StructuralLoadTaskType.LinearStatic:
                ls.Add("GSS");
                ls.Add("STATIC");
                // Defaults:
                ls.Add("1");
                ls.Add("0");
                ls.Add("128");
                ls.Add("SELF");
                ls.Add("none");
                ls.Add("none");
                ls.Add("DRCMEFNSQBHU*");
                ls.Add("MIN");
                ls.Add("AUTO");
                ls.Add("0");
                ls.Add("0");
                ls.Add("0");
                ls.Add("NONE");
                ls.Add("FATAL");
                ls.Add("NONE");
                ls.Add("NONE");
                ls.Add("RAFT_LO");
                ls.Add("RESID_NO");
                ls.Add("0");
                ls.Add("1");
                break;

            case StructuralLoadTaskType.NonlinearStatic:
                ls.Add("GSRELAX");
                ls.Add("BUCKLING_NL");
                // Defaults:
                ls.Add("SINGLE");
                ls.Add("0");
                ls.Add("BEAM_GEO_YES");
                ls.Add("SHELL_GEO_NO");
                ls.Add("0.1");
                ls.Add("0.0001");
                ls.Add("0.1");
                ls.Add("CYCLE");
                ls.Add("100000");
                ls.Add("REL");
                ls.Add("0.0010000000475");
                ls.Add("0.0010000000475");
                ls.Add("DISP_CTRL_YES");
                ls.Add("0");
                ls.Add("1");
                ls.Add("0.01");
                ls.Add("LOAD_CTRL_NO");
                ls.Add("1");
                ls.Add("");
                ls.Add("10");
                ls.Add("100");
                ls.Add("RESID_NOCONV");
                ls.Add("DAMP_VISCOUS");
                ls.Add("0");
                ls.Add("0");
                ls.Add("1");
                ls.Add("1");
                ls.Add("1");
                ls.Add("1");
                ls.Add("AUTO_MASS_YES");
                ls.Add("AUTO_DAMP_YES");
                ls.Add("FF_SAVE_ELEM_FORCE_YES");
                ls.Add("FF_SAVE_SPACER_FORCE_TO_ELEM");
                ls.Add("DRCEFNSQBHU*");
                break;

            case StructuralLoadTaskType.Modal:
                ls.Add("GSS");
                ls.Add("MODAL");
                // Defaults:
                ls.Add("1");
                ls.Add("1");
                ls.Add("128");
                ls.Add("SELF");
                ls.Add("none");
                ls.Add("none");
                ls.Add("DRCMEFNSQBHU*");
                ls.Add("MIN");
                ls.Add("AUTO");
                ls.Add("0");
                ls.Add("0");
                ls.Add("0");
                ls.Add("NONE");
                ls.Add("FATAL");
                ls.Add("NONE");
                ls.Add("NONE");
                ls.Add("RAFT_LO");
                ls.Add("RESID_NO");
                ls.Add("0");
                ls.Add("1");
                break;

            default:
                ls.Add("GSS");
                ls.Add("STATIC");
                // Defaults:
                ls.Add("1");
                ls.Add("0");
                ls.Add("128");
                ls.Add("SELF");
                ls.Add("none");
                ls.Add("none");
                ls.Add("DRCMEFNSQBHU*");
                ls.Add("MIN");
                ls.Add("AUTO");
                ls.Add("0");
                ls.Add("0");
                ls.Add("0");
                ls.Add("NONE");
                ls.Add("FATAL");
                ls.Add("NONE");
                ls.Add("NONE");
                ls.Add("RAFT_LO");
                ls.Add("RESID_NO");
                ls.Add("0");
                ls.Add("1");
                break;
            }
            gwaCommands.Add(string.Join("\t", ls));

            // Set ANAL
            ls.Clear();
            ls.Add("SET");
            ls.Add(keyword + ":" + HelperClass.GenerateSID(loadTask));
            ls.Add(index.ToString());
            ls.Add(loadTask.Name == null || loadTask.Name == "" ? " " : loadTask.Name);
            ls.Add(taskIndex.ToString());
            if (loadTask.TaskType == StructuralLoadTaskType.Modal)
            {
                ls.Add("M1");
            }
            else
            {
                var subLs = new List <string>();
                for (var i = 0; i < loadTask.LoadCaseRefs.Count(); i++)
                {
                    var loadCaseRef = Initialiser.Cache.LookupIndex(typeof(GSALoadCase).GetGSAKeyword(), loadTask.LoadCaseRefs[i]);

                    if (loadCaseRef.HasValue)
                    {
                        if (loadTask.LoadFactors.Count() > i)
                        {
                            subLs.Add(loadTask.LoadFactors[i].ToString() + "L" + loadCaseRef.Value.ToString());
                        }
                        else
                        {
                            subLs.Add("L" + loadCaseRef.Value.ToString());
                        }
                    }
                }
                ls.Add(string.Join(" + ", subLs));
                gwaCommands.Add(string.Join("\t", ls));
            }
            return(string.Join("\n", gwaCommands));
        }
Esempio n. 30
0
        public string SetGWACommand()
        {
            if (this.Value == null)
            {
                return("");
            }

            var destType = typeof(GSASpringProperty);

            var springProp = this.Value as StructuralSpringProperty;

            var keyword = destType.GetGSAKeyword();

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

            var gwaAxisCommand = "";
            var gwaCommands    = new List <string>();

            var axisRef = "GLOBAL";

            if (springProp.Axis == null)
            {
                //Default value
                axisRef = "GLOBAL";
            }
            else
            {
                if (springProp.Axis.Xdir.Value.SequenceEqual(new double[] { 1, 0, 0 }) &&
                    springProp.Axis.Ydir.Value.SequenceEqual(new double[] { 0, 1, 0 }) &&
                    springProp.Axis.Normal.Value.SequenceEqual(new double[] { 0, 0, 1 }))
                {
                    axisRef = "GLOBAL";
                }
                else if (springProp.Axis.Xdir.Value.SequenceEqual(new double[] { 0, 0, 1 }) &&
                         springProp.Axis.Ydir.Value.SequenceEqual(new double[] { 1, 0, 0 }) &&
                         springProp.Axis.Normal.Value.SequenceEqual(new double[] { 0, 1, 0 }))
                {
                    axisRef = "VERTICAL";
                }
                else
                {
                    try
                    {
                        HelperClass.SetAxis(springProp.Axis, out var axisIndex, out gwaAxisCommand, springProp.Name);
                        if (gwaAxisCommand.Length > 0)
                        {
                            gwaCommands.Add(gwaAxisCommand);
                        }
                    }
                    catch { axisRef = "GLOBAL"; }
                }
            }

            var ls = new List <string>
            {
                "SET",
                keyword + ":" + HelperClass.GenerateSID(springProp),
                index.ToString(),
                string.IsNullOrEmpty(springProp.Name) ? "" : springProp.Name,
                "NO_RGB",
                axisRef
            };

            ls.AddRange(SpringTypeCommandPieces(springProp.SpringType, springProp.Stiffness, springProp.DampingRatio ?? 0));

            gwaCommands.Add(string.Join("\t", ls));

            return(string.Join("\n", gwaCommands));
        }