Equivalent of Dynamo's Curve.PlaneAtParameter in Revit API (C#)

Equivalent of Dynamo's Curve.PlaneAtParameter in Revit API (C#)

DesignGroup01
Enthusiast Enthusiast
483 Views
5 Replies
Message 1 of 6

Equivalent of Dynamo's Curve.PlaneAtParameter in Revit API (C#)

DesignGroup01
Enthusiast
Enthusiast

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:

  1. Compute the Point on the Curve:
    Using curve.Evaluate(parameter, true) to find the point at the desired parameter.

  2. Compute the Tangent Vector:
    Using curve.ComputeDerivatives(parameter, true) to get the tangent vector (BasisX).

  3. Compute the Normal Vector:
    Using the tangent vector and cross-product logic to calculate a normal vector.

  4. 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!
0 Likes
484 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Autodesk
Autodesk

I think the approach you describe makes perfect sense, and I am not aware of any other possibilities. What specific issues are you encountering using that?

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 6

jeremy_tammik
Autodesk
Autodesk

If you prefer the approach used in Dynamo's Curve.PlaneAtParameter method, you can take a look at the open source implementation of that and make use of similar techniques in your own code.

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 4 of 6

DesignGroup01
Enthusiast
Enthusiast

Thanks for your answer.😊

 

"I believe the approach you described makes perfect sense, and I am not aware of any other alternatives for this task. The specific issue I'm encountering seems to be related to calculating the correct plane for sweeping the circle along the rebar's centerline. The challenge lies in ensuring the correct alignment of the plane at each point on the curve, especially when the centerline includes multiple segments like arcs or lines. Any guidance on this would be greatly appreciated!"

0 Likes
Message 5 of 6

jeremy_tammik
Autodesk
Autodesk

Well, to address that, you first need to explain exactly what you consider to be the "correct" alignment.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 6 of 6

DesignGroup01
Enthusiast
Enthusiast

This is my step.

"1) Get the rebar's centerline and radius (get diameter from rebar then convert to radius).
2) Create a circle using the rebar's radius.
3) Use the rebar's centerline and the circle with CreateSweptGeometry to generate the solid geometry of the rebar."

 

This should convey your intent clearly.

0 Likes