__author__ = "siddharth_chattoraj"
__version__ = "2024.05.03"

import rhinoscriptsyntax as rs  # rhino functionality
import math

# input
Height = 10            # Convert to mm
Width = int(Width)              # Convert input width to mm
Depth = int(Depth)              # New depth dimension
LayerHeight
Subtraction = int(Subtraction)
Addition = int(Addition)

# output
vertices = []

layerCount = int(Height / LayerHeight)
# Define spacing between threads in the weave
threadSpacing = 5  # 5 mm between threads
threadWidth = 1    # Each thread is 1 mm wide

for i in range(layerCount):
    z = i * LayerHeight - 50  # Base elevation for each layer
    # Alternate the pattern every other layer
    if i % 8 == 0:  # Even layers horizontal
        for x in range(Addition, Width-Subtraction, threadSpacing):
            for y in range(Addition, Depth-Subtraction, threadWidth):
                vertices.append(rs.CreatePoint(x, y, z))
                vertices.append(rs.CreatePoint(x + threadWidth, y, z))
    else:  # Odd layers vertical
        for y in range(Addition, Depth-Subtraction, threadSpacing):
            for x in range(Addition, Width-Subtraction, threadWidth):
                vertices.append(rs.CreatePoint(x, y, z))
                vertices.append(rs.CreatePoint(x, y + threadWidth, z))


