Dynamo Functions

Being busy with Dynamo there is so much you can spend time on learning. I haven’t taken the time to look into functions in Dynamo. Which I regret now, I could have saved myself a lot of time. Tonight I thought let’s look into this as I found myself repeating something in Dynamo a lot. I often need to get a vector from a curve’s start to endpoint. There are curves being created in dynamo that are straight and for which this function may work. This function of course could create havoc for any none straight curves. These straight curves typically come from PolyCurves, edges from flat surfaces and isolines from flat surfaces.

So after reading the dynamo primer for 1 minute.
7-4_functions
A bit of node to code and typing.

  1. Are the original nodes
  2. Is the function I defined at Number 3 in a Code Block
  3. The actual code

In other words this is embarrassingly simple… 


The code: 


/*This is a function for getting a vector from:
a curve start to endpoint*/

def VectorCurveSEPoints(curve1)
{
point1 = Curve.StartPoint(curve1);
point2 = Curve.EndPoint(curve1);
vector1 = Vector.ByTwoPoints(point1, point2);
return vector1;
};

Dynamo Functions

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: