コード例 #1
0
ファイル: SurfaceProperty.cs プロジェクト: BHoM/RFEM_Toolkit
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/

        private List <ISurfaceProperty> ReadSurfaceProperties(List <string> ids = null)
        {
            List <ISurfaceProperty> surfacePropList = new List <ISurfaceProperty>();


            if (ids == null)
            {
                foreach (rf.Surface surface in modelData.GetSurfaces())
                {
                    IMaterialFragment material = modelData.GetMaterial(surface.MaterialNo, rf.ItemAt.AtNo).GetData().FromRFEM();

                    rf.ISurface s = modelData.GetSurface(surface.No, rf.ItemAt.AtNo);
                    rf.IOrthotropicThickness ortho     = s.GetOrthotropicThickness();
                    rf.SurfaceStiffness      stiffness = ortho.GetData();

                    ISurfaceProperty surfaceProperty = stiffness.FromRFEM(material);


                    surfacePropList.Add(surfaceProperty);

                    /*
                     * int srfThickId = srfThickness.No;
                     * if (!m_sectionDict.ContainsKey(srfThickId))
                     * {
                     *  m_sectionDict.Add(srfThickId, srfProp);
                     * }
                     */
                }
            }
            else
            {
                foreach (string id in ids)
                {
                }
            }

            return(surfacePropList);
        }
コード例 #2
0
ファイル: Panel.cs プロジェクト: BHoM/RFEM_Toolkit
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/

        private bool CreateCollection(IEnumerable <Panel> panels)
        {
            if (panels.Count() > 0)
            {
                int          panelIdNum = 0;
                List <Panel> panelList  = panels.ToList();
                rf.Surface[] rfSurfaces = new rf.Surface[panelList.Count()];

                for (int i = 0; i < panels.Count(); i++)
                {
                    panelIdNum = GetAdapterId <int>(panelList[i]);

                    //get ids outside of BHoM process - might need to be changed
                    int lastLineId = modelData.GetLastObjectNo(rf.ModelObjectType.LineObject);


                    int[] boundaryIdArr = new int[panelList[i].ExternalEdges.Count()];

                    //create outline
                    List <string> outlineNodeList = new List <string>();
                    foreach (Edge e in panelList[i].ExternalEdges)
                    {
                        //create rfem nodes, i.e. bhom points - NOTE: RFEM will remove the coincident points itself leaving jumps in node numbering ! 1,2,4,6,8,10,...
                        Line edgeAsLine = e.Curve as Line;

                        rf.Node rfNode1 = new rf.Node
                        {
                            No = (int)this.NextFreeId(typeof(Node)),
                            X  = edgeAsLine.Start.X,
                            Y  = edgeAsLine.Start.Y,
                            Z  = edgeAsLine.Start.Z
                        };
                        modelData.SetNode(rfNode1);

                        outlineNodeList.Add(rfNode1.No.ToString());
                    }
                    outlineNodeList.Add(outlineNodeList[0]);

                    rf.Line outline = new rf.Line()
                    {
                        No       = lastLineId + 1,
                        Type     = rf.LineType.PolylineType,
                        NodeList = String.Join(",", outlineNodeList)
                    };
                    modelData.SetLine(outline);


                    rfSurfaces[i] = panelList[i].ToRFEM(panelIdNum, new int[] { outline.No });

                    if (rfSurfaces[i].StiffnessType == rf.SurfaceStiffnessType.StandardStiffnessType)
                    {
                        modelData.SetSurface(rfSurfaces[i]);
                    }
                    else
                    {
                        rf.SurfaceStiffness stiffness = panelList[i].Property.ToRFEM();
                        rfSurfaces[i].Thickness.Constant = stiffness.Thickness;
                        rf.ISurface srf = modelData.SetSurface(rfSurfaces[i]);
                        rf.IOrthotropicThickness ortho = srf.GetOrthotropicThickness();
                        ortho.SetData(stiffness);
                    }
                }
            }

            return(true);
        }
コード例 #3
0
ファイル: Panel.cs プロジェクト: BHoM/RFEM_Toolkit
        /***************************************************/
        /**** Private methods                           ****/
        /***************************************************/

        private List <Panel> ReadPanels(List <string> ids = null)
        {
            List <Panel>     panelList = new List <Panel>();
            ISurfaceProperty surfaceProperty;

            if (ids == null)
            {
                foreach (rf.Surface surface in modelData.GetSurfaces())
                {
                    if (surface.GeometryType != rf.SurfaceGeometryType.PlaneSurfaceType)
                    {
                        Engine.Base.Compute.RecordError("Only plane surface types are supported at the moment");
                    }

                    List <Edge> edgeList = GetEdgesFromRFEMSurface(surface);

                    IMaterialFragment material = modelData.GetMaterial(surface.MaterialNo, rf.ItemAt.AtNo).GetData().FromRFEM();

                    if (surface.StiffnessType == rf.SurfaceStiffnessType.StandardStiffnessType)
                    {
                        surfaceProperty = new ConstantThickness {
                            Thickness = surface.Thickness.Constant, Material = material
                        };
                    }
                    else if (surface.StiffnessType == rf.SurfaceStiffnessType.OrthotropicStiffnessType)
                    {
                        rf.ISurface s = modelData.GetSurface(surface.No, rf.ItemAt.AtNo);
                        rf.IOrthotropicThickness ortho     = s.GetOrthotropicThickness();
                        rf.SurfaceStiffness      stiffness = ortho.GetData();
                        surfaceProperty = stiffness.FromRFEM(material);
                    }
                    else
                    {
                        surfaceProperty = null;
                        Engine.Base.Compute.RecordError("could not create surface property of type " + surface.StiffnessType.ToString());
                    }

                    List <Opening> openings = null;
                    Panel          panel    = Engine.Structure.Create.Panel(edgeList, openings, surfaceProperty);

                    panelList.Add(panel);
                }
            }
            else
            {
                foreach (string id in ids)
                {
                    rf.Surface surface = modelData.GetSurface(Int32.Parse(id), rf.ItemAt.AtNo).GetData();
                    if (surface.GeometryType != rf.SurfaceGeometryType.PlaneSurfaceType)
                    {
                        Engine.Base.Compute.RecordError("Only plane surface types are supported at the moment");
                    }

                    List <Edge> edgeList = GetEdgesFromRFEMSurface(surface);

                    IMaterialFragment material = modelData.GetMaterial(surface.MaterialNo, rf.ItemAt.AtNo).GetData().FromRFEM();

                    rf.ISurface s = modelData.GetSurface(surface.No, rf.ItemAt.AtNo);
                    rf.IOrthotropicThickness ortho     = s.GetOrthotropicThickness();
                    rf.SurfaceStiffness      stiffness = ortho.GetData();

                    surfaceProperty = stiffness.FromRFEM(material);

                    List <Opening> openings = null;
                    Panel          panel    = Engine.Structure.Create.Panel(edgeList, openings, surfaceProperty);

                    panelList.Add(panel);
                }
            }

            return(panelList);
        }