Line Direction

Hi All,

I’m totally confused about getting the value of Line.Direction in the Revit API compared to DesignScript!

Considering the example in the image below (and taking into account unit conversion to Revit internal units), the Revit API gives an incorrect result for line.Direction, which should be:
(5 * 0.3048 = 1.524, 5 * 0.3048 = 1.524, 0).

Thanks.

It’s not a unit issue. The Revit API returns the unit vector (length = 1) whereas Dynamo returns the full vector (length = 5*sqrt(2)). You can multiply or divide by the line length to go between the two.

1 Like

The Revit API gives the direction as a normalized vector - that is the length of the vector is equal to 1.

The Dynamo API gives the direction as a non-normalized vector - that is the length of the vector is the same as the line.

If you want the Revit vector to be the same length as the line you can scale it by using the multiply method.

If you want to get the Dynamo vector with a length of one you can use the Vector.Normalized node/method.

1 Like

Thank you, @Nick_Boyts @jacob.small for your replies, and apologies for my delayed response!

I now understand the difference in the Direction value resulting from using the Revit API versus Dynamo.

I have another question:
When dealing with a Line, are the second derivative (BasisY) and the bi-normal vector (BasisZ) always null?"

Thanks.

I believe the documentation for those methods has the answer which you seek. Something along the lines of ‘if the second derivative cannot be determined the result will be null or a zero length vector’, but best to check on your own.

1 Like