Sparrow Package - GetGridCurves Help

Hello,

I am trying to use the Ceiling.GetGridCurve from Sparrow Package to grab the ceiling tiles grid from a linked ceiling. It seems like some it only work for some but not all.


Above is a screen shot of an instance when it only output the horizontal lines.


Above is an instance when it works fine.

Can someone explain to me why it does not output the horizontal line sometimes?

@Sean_Fruin any ideas? :slight_smile:

Bugs that we have been meaning to get to for over 4 years. I know it dose not work with slop ceiling. Im not sure the exact reason for this one.

It is a goal of ours to get a Sparrow update out and this is on the top of the list. We are also planning on opensourcing the code. I can get that done quicker and hopfully the community can help.
Sorry I can not help out more right now!!

6 Likes

image
It doesn’t seem to be a sloped ceiling.

Thank you for your responses @Sean.M.Fruin

Out of curiosity, how is the node grabbing the geometry of the grid?

Not my code, but you can get the references to the grid lines and convert them to geometry in Revit, and use those to generate Dynamo curves.

how

I’ll try to post some code tomorrow (nearly midnight and I am on my phone at the start of a four day weekend here in Sweden) but this is what I used to get started:

https://thebuildingcoder.typepad.com/blog/2017/06/hatch-line-dimensioning-voodoo.html

After you create the dimension element you can pull the curves somehow (that part I forget) a perform a rollback which you can use that as the basis of the tiles. Get the first four references (they are paired up in even / odd if memory serves) and offset as needed to fill the whole surface.

5 Likes

Hi @tranthai2711 here is a dirty way i have been used, before i find the Sparrow node :wink: PS the Sparrow node doesnt work on curved boundery, i havent tried on sloped

1 Like

there is the possibility that its not sparrows but something else.

try the script first on arch model, if it works then the problem is not with sparrow its something with other packages. if that is the case, try the script with “select model Element” for the link and maybe “linkelement.ofcategory” from BIMorph and see if that fixes it

this will help zero in on the problem

I think @jacob.small is right here. I was able to get the compound pattern reference and fill pattern properties using genius loci. I’m going to try to generate the ceiling tile curves from that information. Wish me luck!

No worries. Just keeping you honest. :wink:

FWIW, we (Parallax) have a tool that does this and uses that “voodoo” mixed with a few other special ingredients.

3 Likes

Thank you for the suggestion. I’ll use this to reconstruct the tiles from the fill pattern gathered from Genius Loci nodes

I tried it on the arch model and it still output the same result.

I meant without the datashapes nodes (with the ++ node)

@john_pierson Any update on this have a similar issue? It would help a lot with ceiling coordination.

I don’t think the issue with the node has been fixed yet. I have made it worked by reverses engineering the node and reading up on a blog post.

See here:https://thebuildingcoder.typepad.com/blog/2017/06/hatch-line-dimensioning-voodoo.html#4

Bellow is the python node I use to get the grid starting point and direction. I have nodes later in the script that take this and reconstruct the grid.

import clr
# Importing Revit Services
clr.AddReference('RevitServices')
from RevitServices.Persistence import *
from RevitServices.Transactions import TransactionManager
# Importing Revit API
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
# Importing Revit Nodes
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
# Importing Geometry Conversion
clr.ImportExtensions(Revit.GeometryConversion)
# Get the current Revit document
doc = DocumentManager.Instance.CurrentDBDocument # Define the inputs
gridCounts = IN[0]
faces = UnwrapElement(IN[1])
linked_doc = UnwrapElement(IN[2])
# Initialize output lists
gridDimsList=[]
refPointsList=[]
dimLineDir=[]

# Function to process a single set of inputs
def process_inputs(gridCount, faceRefs):
    # Initialize lists to store the references for vertical and horizontal dimensions
    resAr1List = []
    resAr2List = []
    resAr3List = []
    
    for faceRef in faceRefs:  # Iterate over the face references
        e = doc.GetElement(faceRef)
        faceGeom = e.GetGeometryObjectFromReference(faceRef)
        stableRef = faceRef.ConvertToStableRepresentation(doc)
        ip = 0
        while ip < 2:
            index1 = 1 + (ip * gridCount * 2)
            index2 = 2 + (ip * gridCount * 2)
            #index3 = 3 + (ip * gridCount * 2)
            stableHatchString1 = stableRef + '/' + str(index1)
            stableHatchString2 = stableRef + '/' + str(index2)
            #stableHatchString3 = stableRef + '/' + str(index3)
            hatchRef1 = Reference.ParseFromStableRepresentation(doc, stableHatchString1)
            hatchRef2 = Reference.ParseFromStableRepresentation(doc, stableHatchString2)
            #hatchRef3 = Reference.ParseFromStableRepresentation(doc, stableHatchString3)
            resAr1List.append(hatchRef1)
            resAr2List.append(hatchRef2)
            #resAr3List.append(hatchRef3)
            ip += 1
    # Create reference arrays for vertical and horizontal dimensions
    refArr1 = ReferenceArray()
    refArr2 = ReferenceArray()
    refArr3 = ReferenceArray()
    for r in resAr1List:
        refArr1.Append(r)
    for r in resAr2List:
        refArr2.Append(r)
    #for r in resAr3List:
    #    refArr3.Append(r)
    # Create dimensions
    
    
    spoint = XYZ(0, 0, 0)
    epoint = XYZ(10, 0, 0)
    TransactionManager.Instance.EnsureInTransaction(doc)
    dim1 = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(spoint, epoint), refArr1)
    dim2 = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(spoint, epoint), refArr2)
    #dim3 = doc.Create.NewDimension(doc.ActiveView, Line.CreateBound(spoint, epoint), refArr3)
    ElementTransformUtils.MoveElement(doc, dim1.Id, XYZ(0.1, 0, 0))
    ElementTransformUtils.MoveElement(doc, dim2.Id, XYZ(0.1, 0, 0))
    #ElementTransformUtils.MoveElement(doc, dim3.Id, XYZ(0.1, 0, 0))
    gridDimsList.append((dim1.Value, dim2.Value))
    refPointsList.append((dim1.Origin.ToPoint(), dim2.Origin.ToPoint()))
    dimLineDir.append((dim1.Curve.Direction.ToVector(),dim2.Curve.Direction.ToVector()))
    doc.Delete(dim1.Id)
    doc.Delete(dim2.Id)
    #doc.Delete(dim3.Id)
    TransactionManager.Instance.TransactionTaskDone()
    
# Iterate over each item in the inputs
for idx in range(len(gridCounts)):
    gridCount = gridCounts[idx]
    faceRefs = faces[idx] if isinstance(faces[idx], list) else [faces[idx]]
    process_inputs(gridCount, faceRefs)
# Output the lists of dimension values and reference points
OUT = refPointsList,dimLineDir