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