protected override void OnDuplicate(Rhino.DocObjects.Custom.UserData source)
        {
            GeometryLarge src = source as GeometryLarge;

            if (src != null)
            {
                BaseBrep = src.BaseBrep;
            }
        }
Ejemplo n.º 2
0
        public CalcMesh(Mesh m, GeometryLarge gl)
        {
            Append(m);
            int i = 0;

            foreach (MeshFace mf in Faces)
            {
                Mesh tempMesh = new Mesh();
                if (mf.IsTriangle)
                {
                    tempMesh.Vertices.Add(m.Vertices[mf.A]);
                    tempMesh.Vertices.Add(m.Vertices[mf.B]);
                    tempMesh.Vertices.Add(m.Vertices[mf.C]);
                    tempMesh.Faces.AddFace(new MeshFace(0, 1, 2));
                }
                else
                {
                    tempMesh.Vertices.Add(m.Vertices[mf.A]);
                    tempMesh.Vertices.Add(m.Vertices[mf.B]);
                    tempMesh.Vertices.Add(m.Vertices[mf.C]);
                    tempMesh.Vertices.Add(m.Vertices[mf.D]);
                    tempMesh.Faces.AddFace(new MeshFace(0, 1, 2, 3));
                }



                Point3d  c    = ((Vertices[mf.A] + (Point3d)Vertices[mf.B]) + Vertices[mf.C]) / 3;
                Vector3d ac   = (Vertices[mf.C] - Vertices[mf.A]);
                Vector3d ab   = (Vertices[mf.B] - Vertices[mf.A]);
                double   area = Vector3d.CrossProduct(ac, ab).Length / 2;

                //MeshSegments.Add(new MeshSegment(c, area,gl,ns.ToBrep()));
                if (!mf.IsTriangle)
                {
                    Point3d  c2 = ((Vertices[mf.A] + (Point3d)Vertices[mf.C]) + Vertices[mf.D]) / 3;
                    Vector3d ad = (Vertices[mf.D] - Vertices[mf.A]);
                    ab = (Vertices[mf.C] - Vertices[mf.A]);
                    double area2 = Vector3d.CrossProduct(ad, ab).Length / 2;
                    c    = (c * area + c2 * area2) / (area + area2);
                    area = area + area2;
                }
                MeshSegments.Add(new MeshSegment(c, area, gl, tempMesh));
                i++;
            }
        }
Ejemplo n.º 3
0
        private List <GeometryLarge> GetGeometryLarges(List <int> GeometryLargeIds)
        {
            List <GeometryLarge> geometryLarges = new List <GeometryLarge>();

            RhinoObject[] objs = RhinoDoc.ActiveDoc.Objects.FindByUserString("infType", "GeometryLarge", true);
            foreach (RhinoObject rhinoObject in objs)
            {
                Rhino.DocObjects.Custom.UserDataList list = rhinoObject.Attributes.UserData;

                GeometryLarge temp = list.Find(typeof(GeometryLarge)) as GeometryLarge ?? list.Find(typeof(RectangleGeometryLarge)) as GeometryLarge;

                if (temp == null)
                {
                    temp = list.Find(typeof(RectangleGeometryLarge)) as GeometryLarge;
                }
                if (GeometryLargeIds.IndexOf(temp.Id) != -1)
                {
                    geometryLarges.Add(temp);
                }
            }

            return(geometryLarges);
        }