Evaluate method for Revit.DB.Face - How UV() works?

Hello everyone,

I wondering to know how the .Evaluate( UV() ) method can be used simulating the same function of the Dynamo OOTB node Surface.PointAtParameter .

That question is because I noticed that the UV class is not following the given surface properly as the Dynamo node does.

Here a study case I am working on:
I have a room enclosed by a curved wall, my goal is to get the center point of it without using ProtoGeometry but, giving a UV(0.5,0.5), the evaluate point isn’t even on the surface (while in ProtoGeometry environment works well). The image below shows in yellow the location of the Revit.DB.Point and in blue the one created after the conversion of the surface into ProtoGeometry:

Here the used script:

...
# Conversion 1Foot = 304.8Millimiter
cnvrs = 304.8

# deinitions
def toList(item):
	if isinstance(item, list):	return item
	else:	return [item]

def moveXYZ(pt, vec, x=1):
	return	XYZ(pt.X+vec.X*x, pt.Y+vec.Y*x, pt.Z+vec.Z*x)

def protoPt(pt):
	return	Autodesk.DesignScript.Geometry.Point.ByCoordinates(pt.X*cnvrs, pt.Y*cnvrs, pt.Z*cnvrs)

doc = DocumentManager.Instance.CurrentDBDocument

# INPUT
room = UnwrapElement(IN[0])

# code
bs = room.GetBoundarySegments(SpatialElementBoundaryOptions())[0]
ply = [x.GetCurve().ToProtoType() for x in bs]

sld = list( room.ClosedShell )[0]
fcs = sld.Faces

uv = UV(0.5,0.5)
t = fcs[3]
t1 = t.Evaluate(uv)
t2 = t.ComputeNormal(uv)
ln = Line.CreateBound(t1, moveXYZ(t1, t2, 10))


### same task using using proto geometry and dynamo
tDyn = t.ToProtoType()[0]
ptDyn = tDyn.PointAtParameter(0.5,0.5)
nrmDyn = tDyn.NormalAtParameter(0.5,0.5)
lnDyn = Autodesk.DesignScript.Geometry.Line.ByStartPointDirectionLength(ptDyn, nrmDyn, 1000)
### same task using using proto geometry and dynamo

# OUTPUT
OUT = tDyn, ln.ToProtoType(), lnDyn, ply

Thank you in advance for you help

Hi @Giuseppe_Dotto I hope you’re well.

There’s no way to use parameterised surface conventions in Revit as we all understand it. This is one of the major shortcomings of Revits geometry engine as it defies these conventions. It treats all surfaces as untrimmed. You’ll either need to stick with Dynamo or find an alternative - Rhino.Inside? - which isn’t a heap of @!#$. Alternatively, if you are dealing with planar faces and know the overall width and length you can potentially work it out from there, but its going to be a major pain considering parameter space is always within the bounds of the surface…unless its Revit.

Hi @Thomas_Mahon , all good, thanks, hope with you is the same!

That was exactly the answer I wasn’t hoping to have… or maybe yes, considering all the time I spent diving in the API and in forums with no luck! :grin:
At a certain point I also thought on a workaround, by using the method .IsInside(UV), to let the computer get the uv limits and allow me to retrieve approximately the center. But I guess this is one of those massive solution that let the script be so fragile and dangerous… the infinite loop is alway beyond the corner in those cases!

Thanks for you help