Example #1
0
 internal static Mesh Wrap(IMeshEntity host, bool persist = true)
 {
     if (host == null)
     {
         return((Mesh)null);
     }
     return(new Mesh(host, persist));
 }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vertices"></param>
        /// <param name="edgeIndices"></param>
        /// <returns></returns>
        private static Mesh ByVerticesEdgeIndices(Point[] vertices, int[] edgeIndices)
        {
            IPointEntity[] points = vertices.ConvertAll(GeometryExtension.ToEntity <Point, IPointEntity>);
            IMeshEntity    entity = ByVerticesEdgeIndicesCore(points, edgeIndices);
            Mesh           mesh   = new Mesh(entity);

            mesh.EdgeIndices     = edgeIndices;
            mesh.VertexPositions = vertices;
            return(mesh);
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vertices"></param>
        /// <param name="faceIndices"></param>
        /// <returns></returns>
        public static Mesh ByVerticesFaceIndices(Point[] vertices, int[][] faceIndices)
        {
            IPointEntity[] points = vertices.ConvertAll(GeometryExtension.ToEntity <Point, IPointEntity>);
            IMeshEntity    entity = ByVerticesFaceIndicesCore(points, faceIndices);
            Mesh           mesh   = new Mesh(entity, true);

            mesh.FaceIndices     = faceIndices;
            mesh.VertexPositions = vertices;
            return(mesh);
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="points"></param>
        /// <param name="edgeIndices"></param>
        /// <returns></returns>
        internal static IMeshEntity ByVerticesEdgeIndicesCore(IPointEntity[] points, int[] edgeIndices)
        {
            string kMethodName = "Mesh.ByVerticesEdgeIndices";

            if (points.Length < 3 || points.ArePointsColinear())
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "vertices", kMethodName));
            }

            IMeshEntity entity = HostFactory.Factory.MeshByVerticesEdgeIndices(points, edgeIndices);

            if (null == entity)
            {
                throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName));
            }

            return(entity);
        }
Example #5
0
 internal Mesh(IMeshEntity mesh, bool isVisible) : base(mesh)
 {
     SetVisibility(isVisible);
 }
Example #6
0
 internal Mesh(IMeshEntity mesh) : base(mesh)
 {
 }
Example #7
0
 internal Mesh(IMeshEntity host, bool persist)
     : base((IDesignScriptEntity)host, persist)
 {
 }