public GsaMember2d(Brep brep, List <Curve> includeCurves = null, List <Point3d> includePoints = null, int prop = 0)
        {
            m_member = new Member
            {
                Type     = MemberType.GENERIC_2D,
                Property = prop
            };
            m_prop        = new GsaProp2d();
            m_prop.Prop2d = null;

            Tuple <Tuple <PolyCurve, List <Point3d>, List <string> >, Tuple <List <PolyCurve>, List <List <Point3d> >, List <List <string> > >, Tuple <List <PolyCurve>, List <List <Point3d> >, List <List <string> >, List <Point3d> > >
            convertBrepInclusion = Util.GH.Convert.ConvertPolyBrepInclusion(brep, includeCurves, includePoints);

            Tuple <PolyCurve, List <Point3d>, List <string> > edgeTuple = convertBrepInclusion.Item1;
            Tuple <List <PolyCurve>, List <List <Point3d> >, List <List <string> > > voidTuple = convertBrepInclusion.Item2;
            Tuple <List <PolyCurve>, List <List <Point3d> >, List <List <string> >, List <Point3d> > inclTuple = convertBrepInclusion.Item3;

            m_crv              = edgeTuple.Item1;
            m_topo             = edgeTuple.Item2;
            m_topoType         = edgeTuple.Item3;
            void_crvs          = voidTuple.Item1;
            void_topo          = voidTuple.Item2;
            void_topoType      = voidTuple.Item3;
            incl_Lines         = inclTuple.Item1;
            incLines_topo      = inclTuple.Item2;
            inclLines_topoType = inclTuple.Item3;
            incl_pts           = inclTuple.Item4;

            m_brep = Util.GH.Convert.BuildBrep(m_crv, void_crvs);
        }
        public GsaProp2d Clone()
        {
            GsaProp2d clone = this.Duplicate();

            clone.m_guid = Guid.NewGuid();
            return(clone);
        }
Beispiel #3
0
        public GsaElement2d Duplicate()
        {
            GsaElement2d dup = new GsaElement2d
            {
                m_elements = m_elements //add clone or duplicate if available
            };

            if (m_mesh != null)
            {
                dup.m_mesh = (Mesh)m_mesh.Duplicate();
                Point3dList point3Ds = new Point3dList(m_topo);
                dup.Topology  = new List <Point3d>(point3Ds.Duplicate());
                dup.m_topoInt = m_topoInt.ToList();
            }
            if (m_id != null)
            {
                int[] dupids = new int[m_id.Count];
                m_id.CopyTo(dupids);
                dup.ID = new List <int>(dupids);
            }
            if (m_props != null)
            {
                GsaProp2d[] dupprop = new GsaProp2d[m_props.Count];
                m_props.CopyTo(dupprop);
                dup.Properties = new List <GsaProp2d>(dupprop);
            }

            return(dup);
        }
        public GsaProp2d Duplicate()
        {
            GsaProp2d dup = new GsaProp2d
            {
                Prop2d = m_prop2d,
                ID     = m_idd
            };

            return(dup);
        }
        public GsaMaterial(GsaProp2d prop)
        {
            if (prop.Material == null)
            {
                return;
            }

            Type             = getType(prop.Prop2d.MaterialType);
            AnalysisProperty = prop.Prop2d.MaterialAnalysisProperty;
            Grade            = prop.Prop2d.MaterialGradeProperty;
        }
Beispiel #6
0
        public GsaElement2d(Mesh mesh, int prop = 0)
        {
            m_elements = new List <Element>();
            m_mesh     = mesh;
            Tuple <List <Element>, List <Point3d>, List <List <int> > > convertMesh = Util.GH.Convert.ConvertMeshToElem2d(mesh, prop);

            m_elements = convertMesh.Item1;
            m_topo     = convertMesh.Item2;
            m_topoInt  = convertMesh.Item3;

            m_id = new List <int>(new int[m_mesh.Faces.Count()]);

            m_props = new List <GsaProp2d>();
            for (int i = 0; i < m_mesh.Faces.Count(); i++)
            {
                GsaProp2d property = new GsaProp2d();
                property.Prop2d = null;
                m_props.Add(property);
            }
        }
        public GsaProp2d Duplicate()
        {
            if (this == null)
            {
                return(null);
            }
            GsaProp2d dup = new GsaProp2d();

            if (m_prop2d != null)
            {
                dup.Prop2d = new Prop2D
                {
                    MaterialAnalysisProperty = m_prop2d.MaterialAnalysisProperty,
                    MaterialGradeProperty    = m_prop2d.MaterialGradeProperty,
                    MaterialType             = m_prop2d.MaterialType,
                    Name         = m_prop2d.Name.ToString(),
                    Description  = m_prop2d.Description.ToString(),
                    Type         = m_prop2d.Type, //GsaToModel.Prop2dType((int)m_prop2d.Type),
                    AxisProperty = m_prop2d.AxisProperty
                };
                if ((System.Drawing.Color)m_prop2d.Colour != System.Drawing.Color.FromArgb(0, 0, 0)) // workaround to handle that System.Drawing.Color is non-nullable type
                {
                    dup.m_prop2d.Colour = m_prop2d.Colour;
                }
            }
            else
            {
                dup.Prop2d = null;
            }

            dup.ID = m_idd;

            if (Material != null)
            {
                dup.Material = m_material.Duplicate();
            }

            dup.m_guid = new Guid(m_guid.ToString());
            return(dup);
        }
        public GsaMember2d(List <Point3d> topology,
                           List <string> topology_type,
                           List <List <Point3d> > void_topology            = null,
                           List <List <string> > void_topology_type        = null,
                           List <List <Point3d> > inlcusion_lines_topology = null,
                           List <List <string> > inclusion_topology_type   = null,
                           List <Point3d> includePoints = null,
                           int prop = 1)
        {
            m_member = new Member
            {
                Type     = MemberType.GENERIC_2D,
                Property = prop
            };

            if (topology.Count == 0)
            {
                m_brep   = null;
                m_crv    = null;
                incl_pts = null;
                return;
            }

            if (topology[0] != topology[topology.Count - 1])
            {
                topology.Add(topology[0]);
                topology_type.Add("");
            }

            m_crv      = Util.GH.Convert.BuildArcLineCurveFromPtsAndTopoType(topology, topology_type);
            m_topo     = topology;
            m_topoType = topology_type;

            if (void_topology != null)
            {
                if (void_crvs == null)
                {
                    void_crvs = new List <PolyCurve>();
                }
                for (int i = 0; i < void_topology.Count; i++)
                {
                    // void curves must be closed, check that topogylist is ending with start point
                    if (void_topology[i][0] != void_topology[i][void_topology[i].Count - 1])
                    {
                        void_topology[i].Add(void_topology[i][0]);
                        void_topology_type[i].Add("");
                    }
                    if (void_topology_type != null)
                    {
                        void_crvs.Add(Util.GH.Convert.BuildArcLineCurveFromPtsAndTopoType(void_topology[i], void_topology_type[i]));
                    }
                    else
                    {
                        void_crvs.Add(Util.GH.Convert.BuildArcLineCurveFromPtsAndTopoType(void_topology[i]));
                    }
                }
            }
            void_topo     = void_topology;
            void_topoType = void_topology_type;

            if (inlcusion_lines_topology != null)
            {
                if (incl_Lines == null)
                {
                    incl_Lines = new List <PolyCurve>();
                }
                for (int i = 0; i < inlcusion_lines_topology.Count; i++)
                {
                    if (inclusion_topology_type != null)
                    {
                        incl_Lines.Add(Util.GH.Convert.BuildArcLineCurveFromPtsAndTopoType(inlcusion_lines_topology[i], inclusion_topology_type[i]));
                    }
                    else
                    {
                        incl_Lines.Add(Util.GH.Convert.BuildArcLineCurveFromPtsAndTopoType(inlcusion_lines_topology[i]));
                    }
                }
            }
            incLines_topo      = inlcusion_lines_topology;
            inclLines_topoType = inclusion_topology_type;

            incl_pts = includePoints;

            m_brep = Util.GH.Convert.BuildBrep(m_crv, void_crvs);

            m_prop        = new GsaProp2d();
            m_prop.Prop2d = null;
        }
 public GsaMember2d()
 {
     m_member      = new Member();
     m_prop        = new GsaProp2d();
     m_prop.Prop2d = null;
 }