Hello everyone, my task is to complete the paving method of Roman-style floor tiles. I hope to complete the automatic paving of any room. Because this pattern cannot form a rectangular repetition, my idea is to generate randomly generated points of specified width in two directions and then connect them into lines to separate them, but the effect is completely wrong. Does anyone have a better idea to complete it? Thank you all.
project1.rvt (7.5 MB)
test (2).dyn (90.0 KB)
Acually, Roman style floor patterns don’t look repeating on each tile, but they are repeating patterns overall. Therefore, it is better to create a pat file and use it rather than using Dynamo to create the pattern.
You can download the pattern I just created.
RomanFloor.pat
Thank you very much for your enthusiastic help.
…and should it come up - other patterns that appear to be non-repeating are actually several different repeating patterns with different spacing overlaid on each other. They can take a while to decipher. (There should be an app for that.
)
Thanks for your reply. I found the relevant plug-in from other netizens on the Internet, but it is a grasshopper program. I am still learning it, so I would like to share it with you to see if I can convert it into a dynamo program. Because I cannot upload the *.gh file, please download it from this link:https://www.dropbox.com/scl/fo/al2bhdb30wxxbz58ebeo9/AMFNXDrHblwpQ_bpnrQfcEE?rlkey=chmy03t8zslmiy65e5mukctt4&st=c67u3z1v&dl=0
Note that the patter you presented is well within the capability of the AutoCAD/Revit pattern (*.pat) file format. It is just a matter of finding how the lines repeat.
The pattern you provided just offsets horizontally and then the next row rotates 180 and offsets horizontally. You just need the XY start point of each line, length of line. Distance to next start point (gap) and offset of that line. Some color pencil work helps, but this isn’t too tough to work out in notepad.
There are some commercial apps that let you do this graphically, but I’ve found them somewhat limited. pyRevit has a pattern creator tool. But it is limited to simple repeating grids. This is also possible to code in dynamo or python.
If this is your first time writing a pat file, start with one horizontal definition. Your offset is the net distance from block to block. Your vertical offset is block + rotated block as the interlock.
Get one repeating block working. Then the second block. The copy the two together.
I’d just knock this one out in notepad.
Thank you for your advice. I’ve actually been looking for a way to quickly process various patterns and reduce repetitive tasks. Recently, in my spare time, I used AI to develop a Dynamo program. It allows me to easily import any pattern generated in Excel into Dynamo, where I can array them as needed and then transfer the results into Revit. I hope this can be helpful to those who might need it.strong text
Floor tile division.dyn (55.0 KB)
1.xlsx (9.7 KB)
I’m glad you were able to solve your problem and thank you for contributing to the forum and being part of the community here.
More of a general comment on AI coding - If you are just beginning it may work, however the code will be inefficient, and to some extent, verbose and overwrought. It’s not as magic as it seems if you have some knowledge and understanding of coding
Here are the first 26 lines of the code with comments removed.
Below shows sys, clr and Autodesk.DesignScript.Geometry being loaded three times, dataEnteringNode is defined twice and the Numpy library (which is a large import) is being loaded and not even used. I could go on.
Here’s how you could do it - use the merged cell ranges to create a tile object, then iterate through all the cells and if they have already been seen in a merged cell skip, finally format the output to be useable by Dynamo. I did use AI for code completion, however I worked out how to structure my code by using the openpyxl docs and a lot of trial and error.
from pathlib import Path
from openpyxl import load_workbook
from openpyxl.worksheet.cell_range import CellRange
class Tile:
def __init__(self, cell_range):
if not isinstance(cell_range, CellRange):
cell_range = CellRange(cell_range.coordinate)
self.min_x = cell_range.min_col - 1
self.min_y = cell_range.min_row - 1
self.max_x = cell_range.max_col
self.max_y = cell_range.max_row
@property
def cells(self):
return [
(row, col)
for row in range(self.min_y + 1, self.max_y + 1)
for col in range(self.min_x + 1, self.max_x + 1)
]
@property
def coords(self):
return [
(self.min_x, self.min_y),
(self.min_x, self.max_y),
(self.max_x, self.max_y),
(self.max_x, self.min_y),
]
@property
def line_points(self):
return list(zip(*self.coords))
filepath = Path(IN[0])
wb = load_workbook(filepath)
ws = wb.active
seen = set()
tiles = []
# Collect all merged cells as tiles
for merged_cell in ws.merged_cells.ranges:
tile = Tile(merged_cell)
tiles.append(tile)
seen.update(tile.cells)
# Collect all regular cells with a value
for row in ws:
for cell in row:
if (cell.row, cell.column) in seen:
continue
if cell.value:
tile = Tile(cell)
tiles.append(tile)
seen.update(tile.cells)
OUT = [tile.line_points for tile in tiles]
Thank you for refining and writing the code. Actually, I initially had AI develop this program in a Python environment for experimentation. The instructions included automatically generating and filling various polygonal shapes to represent rooms, which is likely why the Numpy library was introduced. After successful testing in Python, I adapted the code for Dynamo.
I should mention that I’m still not fully able to comprehend every part of the code. My approach mainly involved conveying my requirements to the AI, copying the code into Dynamo, and iteratively refining it based on error messages until it ran successfully. Some of the redundancies you pointed out may have resulted from these repeated revisions.
The code you provided is exceptionally concise and efficient — to me, it’s like a beautiful piece of music. I’m certain it will be a great help to many others.
Thank you and have a nice day





