Esempio n. 1
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);
        }
Esempio n. 2
0
        public GsaElement2d Duplicate()
        {
            if (this == null)
            {
                return(null);
            }
            if (m_mesh == null)
            {
                return(null);
            }

            GsaElement2d dup = new GsaElement2d();

            dup.m_mesh    = (Mesh)m_mesh.Duplicate();
            dup.m_topo    = m_topo.ToList();
            dup.m_topoInt = m_topoInt.ToList();

            dup.m_props = new List <GsaProp2d>();

            for (int i = 0; i < m_elements.Count; i++)
            {
                dup.m_elements.Add(new Element()
                {
                    Group            = m_elements[i].Group,
                    IsDummy          = m_elements[i].IsDummy,
                    Name             = m_elements[i].Name.ToString(),
                    OrientationNode  = m_elements[i].OrientationNode,
                    OrientationAngle = m_elements[i].OrientationAngle,
                    Offset           = m_elements[i].Offset,
                    ParentMember     = m_elements[i].ParentMember,
                    Property         = m_elements[i].Property,
                    Topology         = new ReadOnlyCollection <int>(m_elements[i].Topology.ToList()),
                    Type             = m_elements[i].Type //GsaToModel.Element2dType((int)Elements[i].Type)
                });

                if ((System.Drawing.Color)m_elements[i].Colour != System.Drawing.Color.FromArgb(0, 0, 0)) // workaround to handle that System.Drawing.Color is non-nullable type
                {
                    dup.m_elements[i].Colour = m_elements[i].Colour;
                }

                dup.m_elements[i].Offset.X1 = m_elements[i].Offset.X1;
                dup.m_elements[i].Offset.X2 = m_elements[i].Offset.X2;
                dup.m_elements[i].Offset.Y  = m_elements[i].Offset.Y;
                dup.m_elements[i].Offset.Z  = m_elements[i].Offset.Z;

                if (m_props[i] != null)
                {
                    dup.m_props.Add(m_props[i].Duplicate());
                }
                else
                {
                    dup.m_props.Add(null); //dup.m_props.Add(new GsaProp2d());
                }
            }

            dup.Colours = new List <System.Drawing.Color>(Colours);

            if (m_id != null)
            {
                int[] dupids = new int[m_id.Count];
                m_id.CopyTo(dupids);
                dup.ID = new List <int>(dupids);
            }


            return(dup);
        }