Beispiel #1
0
 /// <summary>
 /// Creates a part from a give reference representation.
 /// </summary>
 /// <param name="rep">The reference representation of that part.</param>
 /// <param name="instance3D"></param>
 /// <returns>a new part object</returns>
 public static IPart FromReferenceRep(ReferenceRep rep, Instance3D instance3D)
 {
     var triangles = rep.Shell.Triangles;
     var p = new Part
     {
         Name = rep.Name,
         Vertices = triangles.SelectMany(x => new List<Vector3> {x.V1, x.V2, x.V3}).ToList(),
         Triangles = Enumerable.Range(0, triangles.Count*3).ToList(),
         Position = instance3D.Position,
         Rotation = instance3D.Rotation
     };
     return p;
 }
Beispiel #2
0
        /// <summary>
        /// Creates a part from a give reference representation.
        /// </summary>
        /// <param name="rep">The reference representation of that part.</param>
        /// <param name="instance3D"></param>
        /// <returns>a new part object</returns>
        public static IPart FromReferenceRep(ReferenceRep rep, Instance3D instance3D)
        {
            var triangles = rep.Shell.Triangles;
            var p         = new Part
            {
                Name     = rep.Name,
                Vertices = triangles.SelectMany(x => new List <Vector3> {
                    x.V1, x.V2, x.V3
                }).ToList(),
                Triangles = Enumerable.Range(0, triangles.Count * 3).ToList(),
                Position  = instance3D.Position,
                Rotation  = instance3D.Rotation
            };

            return(p);
        }