My question is hard for me to explain, so have mercy. It's about creating an AutoCAD .pat hatch pattern from a line segment within a rectangle with the coordinates [0,0] and[1,1], that sould form a seamless hatch pattern. In AutoCAD, a line segment will continue with a spaceing in the line direction and then it repeats.
For the AutoCAD pattern, I need the "shift" and "offet" values. Here's a LISP code that does what I want, but it's way over my head: https://autocadtips1.com/2011/10/11/autolisp-make-and-save-custom-hatch-pattern/
Assume a grid of N x M fields (yellow in the picture). I have a pattern that describes a shape in field [0,0]. That pattern (red square) repeats at each field [N,M]. Now, in order to also fill the fields from [0,0] to [N,M], I have to repeat the pattern, by adding a copy at a given position [U,V]. This pattern, again is moved by [U,V] and so on. Now, Uand V should be calculated, so the area[0,0] to [N,M] is 1) completely filled and 2) no duplicates are drawn.
Here's some examples that I found out by trial & error:
N,M = 4,1; U,V = 1,0
N,M = 9,4; U,V = 2,1
N,M = 18,5; U,V = 11,3