# About the problem of automatic laying of irregular patterns

**URL:** <https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730>\
**Category:** Revit\
**Created:** [March 13, 2025, 2:25pm UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730 "2025-03-13T14:25:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dagan7626](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dagan7626](https://forum.dynamobim.com/u/dagan7626)\
**Post date:** [March 13, 2025, 2:25pm UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/1 "2025-03-13T14:25:33Z")

</div>

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](https://forum.dynamobim.com/uploads/short-url/skQKeMewk1yPdMfPE0xx5qPohMJ.rvt) (7.5 MB)  
[test (2).dyn](https://forum.dynamobim.com/uploads/short-url/lhzQ2MxrfitmfAxLdKPgr4rMAqM.dyn) (90.0 KB)

 ![微信截图_20250217194245](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/3/93d282e3900316b39da7385bab3c1a23cd4b0eb3.png)

---

<div class="post-metadata">

**Author:** ![Hyunu\_Kim](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hyunu_kim/32/100239_2.png) [@Hyunu\_Kim](https://forum.dynamobim.com/u/Hyunu_Kim)\
**Post date:** [March 24, 2025, 8:21am UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/2 "2025-03-24T08:21:11Z")

</div>

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.

 ![2025-03-24 17 12 45](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/8/48c9d0e2296013b526e880966211bb7dc1d43ebb.png)  
You can download the pattern I just created.  
[RomanFloor.pat](https://drive.google.com/file/d/1CnJidrMNnQaoN8t0blS1e8y3y0r5_npi/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![dagan7626](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dagan7626](https://forum.dynamobim.com/u/dagan7626)\
**Post date:** [April 1, 2025, 2:38pm UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/3 "2025-04-01T14:38:16Z")

</div>

Thank you very much for your enthusiastic help.

---

<div class="post-metadata">

**Author:** ![aaronrumple](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aaronrumple/32/195292_2.png) [@aaronrumple](https://forum.dynamobim.com/u/aaronrumple)\
**Post date:** [April 2, 2025, 1:53pm UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/4 "2025-04-02T13:53:50Z")

</div>

…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. 😉 )

---

<div class="post-metadata">

**Author:** ![dagan7626](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dagan7626](https://forum.dynamobim.com/u/dagan7626)\
**Post date:** [April 8, 2025, 8:50am UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/5 "2025-04-08T08:50:13Z")

</div>

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](https://www.dropbox.com/scl/fo/al2bhdb30wxxbz58ebeo9/AMFNXDrHblwpQ_bpnrQfcEE?rlkey=chmy03t8zslmiy65e5mukctt4&st=c67u3z1v&dl=0)

---

<div class="post-metadata">

**Author:** ![aaronrumple](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/aaronrumple/32/195292_2.png) [@aaronrumple](https://forum.dynamobim.com/u/aaronrumple)\
**Post date:** [April 8, 2025, 7:34pm UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/6 "2025-04-08T19:34:56Z")

</div>

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](https://discourse.pyrevitlabs.io/) 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.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/3/23a7bbc35b19a0812fa8303093daf256c0fabedb.png)

---

<div class="post-metadata">

**Author:** ![dagan7626](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dagan7626](https://forum.dynamobim.com/u/dagan7626)\
**Post date:** [September 4, 2025, 8:45am UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/7 "2025-09-04T08:45:04Z")

</div>

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](https://forum.dynamobim.com/uploads/short-url/afZk4EmEEwwbhopXzHOA0pCJeXm.dyn) (55.0 KB)

[1.xlsx](https://forum.dynamobim.com/uploads/short-url/t4DwUP7D4VsinZNJoeeFwfqiwjw.xlsx) (9.7 KB)

 ![wechat_2025-09-04_164028_403](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/a/ba169dc0cb83f90caeeefde208d687876543be8f.png)

---

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [September 5, 2025, 12:21pm UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/8 "2025-09-05T12:21:39Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/d/bd8656d225ce27e36c0f43ae520824bf8e5a0f6c.png)

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.

```python
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]

```

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/8/f8e8637a0d6cbb1b15bed42dcbccaccc1b676255.png)

---

<div class="post-metadata">

**Author:** ![dagan7626](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dagan7626](https://forum.dynamobim.com/u/dagan7626)\
**Post date:** [September 5, 2025, 1:36pm UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/9 "2025-09-05T13:36:50Z")

</div>

> [@Mike.Buttery](#):
>
> Numpy 庫

**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.**

---

<div class="post-metadata">

**Author:** ![dagan7626](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dagan7626](https://forum.dynamobim.com/u/dagan7626)\
**Post date:** [September 5, 2025, 1:37pm UTC](https://forum.dynamobim.com/t/about-the-problem-of-automatic-laying-of-irregular-patterns/108730/10 "2025-09-05T13:37:49Z")

</div>

Thank you and have a nice day
