Extract Floor Points with Python

I am trying to create a node that can get the xyz vertices of a shape-edited Floor. It would essentially be the opposite of the Clockwork node RoofOrFloor.SlabShapeByPoints, except it only has a single input (Floor) and a single output (Points).

I have used the script from the Clockwork node as a “template,” but so far my script is not doing anything. This is the main part that I am struggling with:

TransactionManager.Instance.EnsureInTransaction(doc)
slabshape.SlabShape.Editor.Enable()
for item in slabshape:
xyzs.append(slabshape.SlabShapeEditor.SlabShapeVertexArray())
TransactionManager.Instance.TransactionTaskDone()

 

I am fairly new at this, so I’m not sure if I need to do some additional geometry conversion or if I’m not using the RevitApit correctly.

Any help would be greatly appreciated!

 

Here is the full script:

import clr
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
slabshape = UnwrapElement(IN[0])
xyzs = list()
successlist = list()
faillist = list()

TransactionManager.Instance.EnsureInTransaction(doc)
slabshape.SlabShape.Editor.Enable()
for item in slabshape:
xyzs.append(slabshape.SlabShapeEditor.SlabShapeVertexArray())
TransactionManager.Instance.TransactionTaskDone()

OUT = xyzs

Hi, try the following:

2015-09-17_17-08-21

Awesome, thanks!

Though I would like to understand… what is happening with this line:

for v in vert:
points.append(v.Position.ToPoint(True))

Lauren, I don’t know if you’re using Python for some particular reason.

While I’m sure Dimitar will clarify your Python doubt, just wanted to point out (assuming you aren’t already aware) that the same can be easily done with OOTB nodes

20150917-5

Hi Vikram. I have tried the Element.Geometry node, though for some reason it does not work for me like it does for you. This is why I looked at Python. Are you using a Floor element? That is what I am trying to get the vertices from. Thanks for the suggestion, though.

Good thinking, Vikram. I forgot about the “Topology.Vertices” node.

Lauren, the previous line gives us a list of all of the floor vertices ( https://en.wikipedia.org/wiki/Vertex_(geometry) . The line you highlighted goes through each vertex in the list, extracts its XYZ location and then converts that to a Dynamo point.

Used a floor (Generic 150mm from the default Metric template) with Sub Elements modified (as it seemed like that was your intent ) and one of the more recent Dynamo builds (0.8.3)

I am still using 0.8.2, so maybe that is it.

Lauren,

What are the purpose of these points? How are you using them?

Im very new to Dynamo and i think these points has potential for landscape hardscape floors.

Just wondering.

Hi @Dimitar_Venkov do you have clear copy of the code? Im trying to do the same but still no luck. Thank you.

Hi,

You can now directly use the built-in “Floor.Points” node:

image

1 Like

Thank you. I’ll check if it’s available in 1.2