/***************************************************/ /**** 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); }
public static MeshSettings2D ToMeshSettings2D(this IFAttribute lusasAttribute) { /***************************************************/ /**** Public Methods ****/ /***************************************************/ string attributeName = GetName(lusasAttribute); int xDivisions = 0; int yDivisions = 0; double size = 0; Split2D splitMethod = Split2D.Automatic; if ((lusasAttribute.getValue("size") == 0) && (lusasAttribute.getValue("xDivisions") == 0 && lusasAttribute.getValue("yDivisions") == 0)) { } else if (lusasAttribute.getValue("size") == 0) { splitMethod = Split2D.Divisions; xDivisions = lusasAttribute.getValue("xDivisions"); yDivisions = lusasAttribute.getValue("yDivisions"); } else { splitMethod = Split2D.Size; size = lusasAttribute.getValue("size"); } MeshSettings2D meshSettings2D = new MeshSettings2D { Name = attributeName, SplitMethod = splitMethod, xDivisions = xDivisions, yDivisions = yDivisions, ElementSize = size }; int adapterNameId = GetAdapterID(lusasAttribute, 'e'); meshSettings2D.SetAdapterId(typeof(LusasId), adapterNameId); return(meshSettings2D); }
private IFMeshSurface CreateMeshSettings2D(MeshSettings2D meshSettings2D) { /***************************************************/ /**** Private Methods ****/ /***************************************************/ if (!Engine.Adapters.Lusas.Query.CheckIllegalCharacters(meshSettings2D.Name)) { return(null); } IFMeshSurface lusasSurfaceMesh = null; if (d_LusasData.existsAttribute("Mesh", meshSettings2D.Name)) { lusasSurfaceMesh = (IFMeshSurface)d_LusasData.getAttribute("Mesh", meshSettings2D.Name); } else { lusasSurfaceMesh = d_LusasData.createMeshSurface(meshSettings2D.Name); if (meshSettings2D.SplitMethod == Split2D.Automatic) { lusasSurfaceMesh.addElementName("QTS4"); } else if (meshSettings2D.SplitMethod == Split2D.Divisions) { lusasSurfaceMesh.setRegular("QTS4", meshSettings2D.xDivisions, meshSettings2D.yDivisions); } else if (meshSettings2D.SplitMethod == Split2D.Size) { lusasSurfaceMesh.setRegularSize("QTS4", meshSettings2D.ElementSize); } } if (lusasSurfaceMesh != null) { int adapterIdName = lusasSurfaceMesh.getID(); meshSettings2D.SetAdapterId(typeof(LusasId), adapterIdName); return(lusasSurfaceMesh); } return(null); }
/***************************************************/ /**** Private Methods ****/ /***************************************************/ private List <MeshSettings2D> ReadMeshSettings2D(List <string> ids = null) { List <MeshSettings2D> meshSettings2Ds = new List <MeshSettings2D>(); object[] lusasMesh2Ds = d_LusasData.getAttributes("Surface Mesh"); for (int i = 0; i < lusasMesh2Ds.Count(); i++) { IFMeshSurface lusasMesh2D = (IFMeshSurface)lusasMesh2Ds[i]; MeshSettings2D meshSettings2D = Adapters.Lusas.Convert.ToMeshSettings2D(lusasMesh2D); List <string> analysisName = new List <string> { lusasMesh2D.getAttributeType() }; meshSettings2D.Tags = new HashSet <string>(analysisName); if (meshSettings2D != null) { meshSettings2Ds.Add(meshSettings2D); } } return(meshSettings2Ds); }