Пример #1
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Panel ToPanel(this IFSurface lusasSurface,
                                    Dictionary <string, Edge> edges,
                                    HashSet <string> groupNames,
                                    Dictionary <string, ISurfaceProperty> surfaceProperties,
                                    Dictionary <string, IMaterialFragment> materials,
                                    Dictionary <string, Constraint4DOF> supports,
                                    Dictionary <string, MeshSettings2D> meshes)

        {
            object[]      lusasSurfaceLines = lusasSurface.getLOFs();
            List <ICurve> dummyCurve        = new List <ICurve>();

            int n = lusasSurfaceLines.Length;
            HashSet <string> tags = new HashSet <string>(IsMemberOf(lusasSurface, groupNames));

            List <Edge> surfaceEdges = new List <Edge>();

            for (int i = 0; i < n; i++)
            {
                Edge edge = GetEdge(lusasSurface, i, edges);
                surfaceEdges.Add(edge);
            }

            Panel panel = Engine.Structure.Create.Panel(surfaceEdges, dummyCurve);

            panel.Tags = tags;

            int adapterID = lusasSurface.getID();

            panel.SetAdapterId(typeof(LusasId), adapterID);

            List <string> geometricAssignments = GetAttributeAssignments(lusasSurface, "Geometric");
            List <string> materialAssignments  = GetAttributeAssignments(lusasSurface, "Material");

            IMaterialFragment panelMaterial;
            ISurfaceProperty  surfaceProperty;

            if (!(geometricAssignments.Count() == 0))
            {
                surfaceProperties.TryGetValue(geometricAssignments[0], out surfaceProperty);
                if (!(materialAssignments.Count() == 0))
                {
                    materials.TryGetValue(materialAssignments[0], out panelMaterial);
                    surfaceProperty.Material = panelMaterial;
                }

                panel.Property = surfaceProperty;
            }

            MeshSettings2D surfaceMesh;
            List <string>  meshSettings = GetAttributeAssignments(lusasSurface, "Mesh");

            if (!(meshSettings.Count() == 0))
            {
                meshes.TryGetValue(meshSettings[0], out surfaceMesh);
                panel.Fragments.Add(surfaceMesh);
            }

            return(panel);
        }
Пример #2
0
        /***************************************************/
        /**** Private Methods                           ****/
        /***************************************************/

        private static Edge GetEdge(IFSurface lusasSurf, int lineIndex, Dictionary <string, Edge> bars)
        {
            Edge   edge;
            IFLine lusasEdge = lusasSurf.getLOFs()[lineIndex];

            bars.TryGetValue(lusasEdge.getID().ToString(), out edge);
            return(edge);
        }
Пример #3
0
        public List <List <double[]> > getSurfaceCoordinatesFromLusas()
        {
            IFSelection userInp = lusas.getSelection();

            //check if selection is at least one point
            if (userInp.countSurfaces() < 1)
            {
                MessageBox.Show("please select at least one point", "", MessageBoxButtons.OK);
                return(null);
            }

            //create collection to popoulate surfaces
            List <List <double[]> > surfaces = new List <List <double[]> >();

            for (int i = 0; i < userInp.countSurfaces(); i++)
            {
                //gereate array of ids
                List <int> pointIds = new List <int>();

                //generate collection for populating vertices
                List <double[]> vertexes = new List <double[]>();

                IFSurface surface = userInp.getSurface(i);
                object[]  lines   = surface.getLOFs() as object[];
                for (int l = 0; l < lines.Length; l++)
                {
                    IFLine   line   = lines[l] as IFLine;
                    object[] points = line.getLOFs() as object[];
                    for (int k = 0; k < points.Length; k++)
                    {
                        IFPoint point = points[k] as IFPoint;
                        int     id    = point.getID();

                        if (!pointIds.Contains(id))
                        {
                            pointIds.Add(id);
                            double[] position = new double[3];
                            position[0] = point.getX();
                            position[1] = point.getY();
                            position[2] = point.getZ();
                            //point.getXYZ(position[0],position[1],position[2]);
                            vertexes.Add(position);
                        }
                    }
                }
                surfaces.Add(vertexes);
            }
            return(surfaces);
        }