Equivalent of Dynamo's Curve.PlaneAtParameter in Revit API (C#)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I am trying to replicate the functionality of Dynamo's Curve.PlaneAtParameter node in C# using the Revit API. Specifically, I need to compute a plane that is perpendicular to a Revit curve (line or arc) at a specified parameter.
In Dynamo, this node conveniently provides a plane at any parameter along a curve. I am looking for the best way to achieve the same in Revit API. Here's what I have attempted so far:
Compute the Point on the Curve:
Using curve.Evaluate(parameter, true) to find the point at the desired parameter.Compute the Tangent Vector:
Using curve.ComputeDerivatives(parameter, true) to get the tangent vector (BasisX).Compute the Normal Vector:
Using the tangent vector and cross-product logic to calculate a normal vector.Create the Plane:
Finally, constructing the plane using Plane.CreateByOriginAndBasis.
While this approach works for many cases, I have encountered issues with unbounded curves, parameter range validation, and certain edge cases where the tangent and normal vectors result in errors or invalid geometry.
I would appreciate guidance on:
- The correct way to handle unbounded curves.
- Best practices for computing perpendicular planes robustly, especially in edge cases.
- Any Revit API method that directly provides the equivalent of Curve.PlaneAtParameter.
Thanks in advance!