Hatch pattern

I’m playing with one of the nodes from geniusloci package.

It aligns patterns to a corner.

I want to offset my tile by half the width and half the length so the tile centre is aligned rather than the join.

In the API the FillPattern Properties LengthPerArea and LinesPerLength both give me the same number (despite the tiles I’m using being 600 x 1200. And StrokesPerArea give me 0.

How do I offset the tiles by half the length and half the width?

ceiling = IN[0]
elements = UnwrapElement(ceiling) if isinstance(ceiling, list) else [UnwrapElement(ceiling)]

for item in elements:
    ext = HostObjectUtils.GetBottomFaces(item)
    end = 1
    
    # for (the array containing) the external face reference, get its geometry
    for e in ext:
        extFace = item.GetGeometryObjectFromReference(e)

        # get the external face surface edges as lines, get the first line (the bottom)
        for index, cv in enumerate(extFace.GetEdgesAsCurveLoops()[0]):
           corner = cv.GetEndPoint(end)

Also, the number I get from the methods above give me an offset of 232 in Revit rather than 300 or 600. Even taking into imperial vs metric I can’t seem to see what this number is.

With a 1200 x 600 ceiling I get

1 >> line 42
2 >> line 43
3 >> line 44

With a 600 x 600 ceiling grid I get
1.016 instead of 0.762

I have no idea what these numbers mean.

Two hints:

  1. Look at identifying the underlaying pattern for the references on the U and V grids of your hatch.
  2. Consoder a temporary transaction to get the information you really need (Transaction.Rollback method).

Do you know what the numbers mean?
Or will that become clear when I look at the UV stuff?

I believe so. :slight_smile:

1 Like

Urgh… that was horrible…

I eventually realised the tile size code was already in the code. :person_facepalming:

However it’s taken me forever to work out how to apply the bloody thing!

I took the centre of the overall shape by adding the verticies coords / number of vertices. (CtrPoint)

Then to get the size of the tiles from the Revit hatch:

MyRevitDimension = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(XYZ.Zero, XYZ(10, 0, 0)), refAr)
tileSize = (MyRevitDimension.Value/2)

origin = CtrPoint.Subtract(direction.Multiply(tileSize))

For something so simple I found it super difficult.

Happy New Year :rofl:

1 Like