How to create a Floor using 4 specific 3D coordinate points to host a railing?

Hi everyone,

I’m trying to create a floor in Revit that will serve as a host for a railing. I have the specific coordinates for 4 points, for example:

A: (x = 0, y = 0, z = 0)

B: (x = 5000, y = 0, z = 1000)

C: (x = 0, y = 5000, z = 1000)

D: (x = 5000, y = 5000, z = 2000)

How can I create a floor using these exact 3D points?

Any guidance or suggestions would be greatly appreciated. Thank you!

What have you tried so far?
Have you done a search of the forum?
I would suggest reading the FAQ to assist with getting better responses How to get help on the Dynamo forums

Possible solution here

Yes, this is the way. I tried to find it, but I couldn’t see it. Thank you so much!

Hi, here is an example with Python

you can implement an TransactionGroup

import clr
import sys
import System
from System.Collections.Generic import List, IList, Dictionary, HashSet
#
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)

import math

def loop_from_pts(lst_ds_pts):
    # flat list points
    lst_ds_pts = [DS.Point.ByCoordinates(p.X, p.Y, 0) for p in lst_ds_pts]
    avg_x = sum(p.X for p in lst_ds_pts) / len(lst_ds_pts)
    avg_y = sum(p.Y for p in lst_ds_pts) / len(lst_ds_pts)
    # sort by vectors angle from X
    get_angle_fromX = lambda point : math.atan2(point.Y - avg_y, point.X - avg_x)
    sorted_points = sorted(lst_ds_pts, key=get_angle_fromX)
    #
    polycurve = PolyCurve.ByPoints(sorted_points, True)
    lst_curve = List[DB.Curve]([c.ToRevitType() for c in polycurve.Curves() ])
    #
    curve_loop = CurveLoop.Create(lst_curve)
    return curve_loop


lst_ds_pts = IN[0]
lst_xyz_pts = [p.ToRevitType() for p in lst_ds_pts ]
floor_type = UnwrapElement(IN[1])
level = UnwrapElement(IN[2])

curv_loop = loop_from_pts(lst_ds_pts)

TransactionManager.Instance.ForceCloseTransaction()

t1 = Transaction(doc, "t1")
t1.Start()
floor = Floor.Create(doc, List[CurveLoop]([curv_loop]), floor_type.Id, level.Id)
doc.Regenerate()
slabShapeEditor = floor.GetSlabShapeEditor()
slabShapeEditor.Enable()
t1.Commit()
t2 = Transaction(doc, "t2")
t2.Start()

for v in slabShapeEditor.SlabShapeVertices:
    v : SlabShapeVertex
    print(v.Position.X)
    input_rvt_pt = next((p for p in lst_xyz_pts\
                        if abs(p.X - v.Position.X) < 0.01 and abs(p.Y - v.Position.Y) < 0.01), 
                        None)
    if input_rvt_pt:
        slabShapeEditor.ModifySubElement(v, input_rvt_pt.Z - v.Position.Z)
t2.Commit()

OUT = floor