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)); }
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(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)); }
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 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)); }
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(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)); }
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)); }