Convert IFC framing element to be Revit model element

Hello there;
I’m trying to create a Script to convert a beam from IFC framing element to be Revit model element as shown blow, but i have a problem when running a script creating framing at all sides due to all curve points not only center line, However how I can remove useless points in “Surface.PointAtParameter” to create only one framing model element parallel to center line



use 0.5 for PointAtParameter

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

# Place your code below this line
surfs=IN[0]
max=-1000000
for surf in surfs:
	mp=surf.PointAtParameter(0.5,0.5)
	z=mp.Z
	if z>max:
		max=z
		top=surf
peris=top.PerimeterCurves()
min=100000000
for i in range(2):
	line=peris[i]
	leng=line.Length
	if leng<min:
		indx=i
		min=leng
mp0=peris[indx].PointAtParameter(0.5)
mp1=peris[indx+2].PointAtParameter(0.5)
location=Line.ByStartPointEndPoint(mp0,mp1)
# Assign your output to the OUT variable.
OUT = location
1 Like