Skip to content

ITransformable Interface

Michael Kirschner edited this page May 19, 2016 · 1 revision

###ITransformable (In Development)

To use this API one must currently use reflection to determine if the render package implements this interface or not, failure to do so will break your nodes on Dynamo 1.0.!! We are investigating alternatives and will update this space and the API changes doc with updates.

https://github.com/DynamoDS/Dynamo/blob/master/src/NodeServices/GraphicsDataInterfaces.cs#L217

a sample usage from a zero touch node looks like:

namespace ItranfromableThing
{
    public class TransformableThing : IGraphicItem
    {
        public Geometry geo { get; private set; }
        public CoordinateSystem transform { get; private set; }

        public static TransformableThing byThingGeoCS(Geometry geo, CoordinateSystem cs)
        {
            var tt = new TransformableThing();
            tt.geo = geo;
            tt.transform = cs;
            return tt;
        }


        public void Tessellate(IRenderPackage package, TessellationParameters parameters)
        {
            geo.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 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.orign.y,transform.origin.z,1
}});
            }
               
        }

    }

}


Releases

Roadmap

How To

Dynamo Internals

Contributing

Python3 Upgrade Work

Libraries

FAQs

API and Dynamo Nodes

Clone this wiki locally