示例#1
0
        public void Tessellate(IRenderPackage package, TessellationParameters parameters)
        {
            //could increase performance further by cacheing this tesselation
            Geometry.Tessellate(package, parameters);

            //we use reflection here because this API was added in Dynamo 1.1 and might not exist for a user in Dynamo 1.0
            //if you do not care about ensuring comptability of your zero touch node with 1.0 you can just call SetTransform directly
            //by casting the rendering package to ITransformable.

            //look for the method SetTransform with the double[] argument list.
            var method = package.GetType().
                         GetMethod("SetTransform", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance,
                                   null,
                                   new[] { typeof(double[]) }, null);

            //if the method exists call it using our current transform.
            if (method != null)
            {
                method.Invoke(package, new object[] { new double[]
                                                      { transform.XAxis.X, transform.XAxis.Y, transform.XAxis.Z, 0,
                                                        transform.YAxis.X, transform.YAxis.Y, transform.YAxis.Z, 0,
                                                        transform.ZAxis.X, transform.ZAxis.Y, transform.ZAxis.Z, 0,
                                                        transform.Origin.X, transform.Origin.Y, transform.Origin.Z, 1 } });
            }
        }
示例#2
0
        public void Tessellate(IRenderPackage package, TessellationParameters parameters)
        {
            foreach (Autodesk.DesignScript.Geometry.Mesh m in _meshes)
            {
                m.Tessellate(package, parameters);
            }

            //look for the method SetTransform with the double[] argument list.
            var method = package.GetType().
                         GetMethod("SetTransform", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance,
                                   null,
                                   new[] { typeof(double[]) }, null);

            //if the method exists call it using our current transform.
            if (method != null)
            {
                method.Invoke(package, new object[] { new double[]
                                                      { transform.XAxis.X, transform.XAxis.Y, transform.XAxis.Z, 0,
                                                        transform.YAxis.X, transform.YAxis.Y, transform.YAxis.Z, 0,
                                                        transform.ZAxis.X, transform.ZAxis.Y, transform.ZAxis.Z, 0,
                                                        transform.Origin.X, transform.Origin.Y, transform.Origin.Z, 1 } });
            }
        }
        public void Tessellate(IRenderPackage package, TessellationParameters parameters)
        {
            //could increase performance further by cacheing this tesselation
            Geometry.Tessellate(package, parameters);

            //we use reflection here because this API was added in Dynamo 1.1 and might not exist for a user in Dynamo 1.0
            //if you do not care about ensuring comptability of your zero touch node with 1.0 you can just call SetTransform directly
            //by casting the rendering package to ITransformable.

            //look for the method SetTransform with the double[] argument list.
            var method = package.GetType().
            GetMethod("SetTransform", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance,
                    null,
                    new[] { typeof(double[]) }, null);

            //if the method exists call it using our current transform.
            if (method != null)
            {
                method.Invoke(package, new object[] { new double[]
            {transform.XAxis.X,transform.XAxis.Y,transform.XAxis.Z,0,
            transform.YAxis.X,transform.YAxis.Y,transform.YAxis.Z,0,
            transform.ZAxis.X,transform.ZAxis.Y,transform.ZAxis.Z,0,
            transform.Origin.X,transform.Origin.Y,transform.Origin.Z,1
            }});
            }
        }