/***************************************************/ /**** Private Methods ****/ /***************************************************/ private IFSurface CreateSurface(Panel panel) { List <IFLine> edges = new List <IFLine>(); foreach (Edge edge in panel.ExternalEdges) { string edgeId = GetAdapterId <string>(edge); if (string.IsNullOrEmpty(edgeId)) { Engine.Base.Compute.RecordError("Could not find the ids for at least one Edge, Panel not created."); return(null); } else { edges.Add(d_LusasData.getLineByNumber(edgeId)); } } IFSurface lusasSurface = d_LusasData.createSurfaceBy(edges.ToArray()); if (lusasSurface != null) { int adapterIdName = lusasSurface.getID(); panel.SetAdapterId(typeof(LusasId), adapterIdName); if (!(panel.Tags.Count == 0)) { AssignObjectSet(lusasSurface, panel.Tags); } if (CheckPropertyWarning(panel, p => p.Property) && !Engine.Adapters.Lusas.Query.InvalidSurfaceProperty(panel.Property)) { IFAttribute lusasGeometricSurface = d_LusasData.getAttribute("Surface Geometric", panel.Property.AdapterId <int>(typeof(LusasId))); lusasGeometricSurface.assignTo(lusasSurface); if (CheckPropertyWarning(panel, p => p.Property.Material)) { IFAttribute lusasMaterial = d_LusasData.getAttribute("Material", panel.Property.Material.AdapterId <int>(typeof(LusasId))); lusasMaterial.assignTo(lusasSurface); } } if (panel.Fragments.Contains(typeof(MeshSettings2D))) { IFAssignment meshAssignment = m_LusasApplication.newAssignment(); meshAssignment.setAllDefaults(); MeshSettings2D meshSettings2D = panel.FindFragment <MeshSettings2D>(); IFMeshAttr mesh = d_LusasData.getMesh(meshSettings2D.Name); mesh.assignTo(lusasSurface, meshAssignment); } } return(lusasSurface); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private IFLine CreateLine(Bar bar) { if (!CheckPropertyError(bar, b => b.StartNode, true) || !CheckPropertyError(bar, b => b.EndNode, true) || !CheckPropertyError(bar, b => b.StartNode.Position, true) || !CheckPropertyError(bar, b => b.EndNode.Position, true)) { return(null); } if ( bar.FEAType == BarFEAType.CompressionOnly || bar.FEAType == BarFEAType.TensionOnly) { Engine.Base.Compute.RecordError("Lusas does not support " + bar.FEAType.ToString() + " Bars"); return(null); } string startNodeId = GetAdapterId <string>(bar.StartNode); string endNodeId = GetAdapterId <string>(bar.EndNode); if (string.IsNullOrEmpty(startNodeId) || string.IsNullOrEmpty(endNodeId)) { Engine.Base.Compute.RecordError("Could not find the ids for at least one end node for at least one Bar. Bar not created."); return(null); } IFPoint startPoint = d_LusasData.getPointByNumber(bar.StartNode.AdapterId <int>(typeof(LusasId))); IFPoint endPoint = d_LusasData.getPointByNumber(bar.EndNode.AdapterId <int>(typeof(LusasId))); IFLine lusasLine = d_LusasData.createLineByPoints(startPoint, endPoint); int adapterIdName = lusasLine.getID(); bar.SetAdapterId(typeof(LusasId), adapterIdName); if (bar.Tags.Count != 0) { AssignObjectSet(lusasLine, bar.Tags); } if (CheckPropertyWarning(bar, b => b.SectionProperty) && !Engine.Adapters.Lusas.Query.InvalidSectionProperty(bar.SectionProperty)) { if (!Engine.Adapters.Lusas.Query.InvalidSectionProfile(bar.SectionProperty)) { //Needed in case the SectionProfile is null and was not created if (d_LusasData.existsAttribute("Line Geometric", bar.SectionProperty.AdapterId <int>(typeof(LusasId)))) { IFAttribute lusasGeometricLine = d_LusasData.getAttribute("Line Geometric", bar.SectionProperty.AdapterId <int>(typeof(LusasId))); lusasGeometricLine.assignTo(lusasLine); } if (CheckPropertyWarning(bar, b => b.SectionProperty.Material)) { if (bar.SectionProperty.Material is IOrthotropic) { Engine.Base.Compute.RecordWarning($"Orthotropic Material {bar.SectionProperty.Material.DescriptionOrName()} cannot be assigned to Bar {bar.AdapterId<int>(typeof(LusasId))}, " + $"orthotropic materials can only be applied to 2D and 3D elements in Lusas."); } else if (bar.SectionProperty.Material is IIsotropic) { if (d_LusasData.existsAttribute("Material", bar.SectionProperty.Material.AdapterId <int>(typeof(LusasId)))) { IFAttribute lusasMaterial = d_LusasData.getAttribute("Material", bar.SectionProperty.Material.AdapterId <int>(typeof(LusasId))); lusasMaterial.assignTo(lusasLine); } } } } } if (bar.Support != null) { IFAttribute lusasSupport = d_LusasData.getAttribute("Support", System.Convert.ToInt32(bar.Support.AdapterId <int>(typeof(LusasId)))); lusasSupport.assignTo(lusasLine); IFLocalCoord barLocalAxis = CreateLocalCoordinate(lusasLine); barLocalAxis.assignTo(lusasLine); } if (bar.Fragments.Contains(typeof(MeshSettings1D))) { IFAssignment meshAssignment = m_LusasApplication.newAssignment(); meshAssignment.setAllDefaults(); if (bar.OrientationAngle != 0 && bar.FEAType == BarFEAType.Axial) { Engine.Base.Compute.RecordWarning( "Orientation angle not supported in Lusas for " + bar.FEAType + " element types, this information will be lost when pushed to Lusas"); } meshAssignment.setBetaAngle(bar.OrientationAngle); MeshSettings1D meshSettings1D = bar.FindFragment <MeshSettings1D>(); IFMeshAttr mesh = d_LusasData.getMesh( meshSettings1D.Name + "\\" + bar.FEAType.ToString() + "|" + CreateReleaseString(bar.Release)); mesh.assignTo(lusasLine, meshAssignment); } if (bar.Offset != null) { Engine.Base.Compute.RecordWarning("Offsets are currently unsupported."); } return(lusasLine); }