Get floor pattern line

Hello everybody

I’m willing to know if there is a way to get the lines of the material used in the floors

these lines are the red ones from the image below.

image

Thank you very much for your support!

Hi,

It is not an easy task.
You could use the Compound Pattern Reference node as a starting point.
I think you have to go through the References (API method) to retrieve some points on the red lines.

You can also try getting a FillGrid from the Fill Pattern using the code like this (or nodes shown by Alban probably as well). Then having fill grids you should be able to ‘calculate’ the lines using objects transformation (location, angle etc.) and fill grid’s properties (offset,angle,origin etc.).
https://www.revitapidocs.com/2017/718e6199-8202-a0fb-6359-c1815e746572.htm
Then you’d have to trim those lines with floor’s boundary (if that’s needed).

import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
#The inputs to this node will be stored as a list in the IN variables.
elements = UnwrapElement(IN[0])

output = []

for e in elements:
	for m in e.Materials:
		if not m.SurfacePattern is None:
			fp = m.SurfacePattern.GetFillPattern()
			for fg in fp.GetFillGrids():
				output.append(fg)

#Assign your output to the OUT variable.
OUT = output
2 Likes

Thanks for your support, but i got this error message

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 10, in
AttributeError: ‘Floor’ object has no attribute ‘Materials’

might be an API change, it seems that there is a GetMaterialIds() method instead in the newer versions.
Nevertheless I was probably wrong on the calculation part, if you take a look at this post:
https://forums.autodesk.com/t5/revit-api-forum/dimension-on-hatch-pattern-slab/m-p/7078368

However they propose another approach with references (more along with Alban’s solution I guess)

Unfortunately, none of these nodes provides me an easy approach to what i intend to get.

Any other tips?

Thank you!

Do you have this for filled regions?