Surface

Surface

harilalmn
Advocate Advocate
2,433 Views
3 Replies
Message 1 of 4

Surface

harilalmn
Advocate
Advocate

Hi,

In Dynamo, as we all know, we can create a surface by lofting two curves, then spread a grid of points along the u and v directions, then place family instances at these points. But the surface is not placed in Revit file, but it is within Dynamo.

 

Is it possible to create such "virtual surfaces" using Revit API C#? Or simply, I don't need the surface inside Revit. 

0 Likes
Accepted solutions (1)
2,434 Views
3 Replies
Replies (3)
Message 2 of 4

harilalmn
Advocate
Advocate

I could find a very old article by Jeremy here;

 

https://jeremytammik.github.io/tbc/a/0012_geometry_library.htm

 

In that, he mentioned;

 

"The Revit API does not provide full coverage of geometry creation. For instance, there is currently no way to create face from scratch in the Revit API."

 

and,

 

"The Revit geometry API is not suited for generic geometry calculations with no relation to the building model. One would expect that developers requiring this kind of computation have their own in-house math library anyway."

 

So, if we need to "imagine" points on a surface that is created by some cross sections lofted, is there no possible method to create a temporary surface using Revit API?

 

0 Likes
Message 3 of 4

RPTHOMAS108
Mentor
Mentor
Accepted solution

I think the conclusion is still the same in that it is easier to do elsewhere however the BRepBuilder can create open shells. Such open shells can contain just one face:

 

210929a.PNG

RuledSurface is either ruled between one curve and a point or two curves. Only certain surface types BRepBuilder supports.

 

You have to add the edges in a anticlockwise direction (clockwise for openings) and the curves must be aligned with that direction (as far as I can tell). So this means checking the direction of one curve against the other and if they point in the same direction reverse one (Curve.CreateReversed). Then you form the other edges by connecting lines between the endpoints of the ruled curves (in the right order and direction). Should end up with a curve loop of Curve, Line, Curve, Line. 

 

See:

RuledSurface.Create(Curve, Curve)

BRepBuilder Class

 

Above I've plotted direct shape spheres by dividing the face into 50 segments in the U and V directions.  You can see for a HermiteSpline the parametrisation will not be evenly distributed as is for the arc at the other end. 

 

The general difficulty with BRepBuilder is ensuring the curves for the face edges actually lie on the surface for that face. In the example above it is straightforward because you know the two curves and two lines lie on the surface. It is also easy for PlanarSurface. Imagine however a ruled surface similar to above but with a circular opening not easy to input the edges for the opening (unless you already know them). Perhaps you can find with Face.Intersect(Face,Curve) but the result of that isn't guaranteed.

 

My understanding is BRepBuilder was intended for importing geometry from elsewhere i.e. from a place where these geometric relationships have already been established. However if your manual task is relatively simple you may find it useful.

Message 4 of 4

harilalmn
Advocate
Advocate

@RPTHOMAS108 

That provides a clear insight. Thankyou...!

0 Likes