Creater all Floor boundary based on Grids intersect line

Creater all Floor boundary based on Grids intersect line

osk-t-00812k
Explorer Explorer
479 Views
4 Replies
Message 1 of 5

Creater all Floor boundary based on Grids intersect line

osk-t-00812k
Explorer
Explorer

Hi Everyone!

I have random grids hozizontal and vertical, how to create Floor by 4 line of Grids intersect.
Thank advance!

oskt00812k_0-1702958922044.png

 

0 Likes
Accepted solutions (1)
480 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Always when you have a question on how to apply the Revit API to address a standard task, the collection of official sample code provided by the Revit SDK will provide a good starting point to look for solutions. In this case, a very suitable and helpful SDK sample might be GenerateFloor.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5

manhgt214
Enthusiast
Enthusiast

I same intersect with this problem. @jeremy_tammik Can you show detail solution for it. 

0 Likes
Message 4 of 5

manhgt214
Enthusiast
Enthusiast
Accepted solution

This is my solution based create nest list Points intersect of grids.

int chunkSizeY = GridX.Count;
// Chop the list into chunks
List<List<XYZ>> choppedListY = ChopList(pointY, chunkSizeY);

for (int i = 0; i < choppedListY.Count-1; i++)
{
    for (int j = 0; j < choppedListY[0].Count-1; j++)
    {
        XYZ p1 = choppedListY[i][j];
        XYZ p2 = choppedListY[i][j+1];
        XYZ p3 = choppedListY[i+1][j+1];
        XYZ p4 = choppedListY[i+1][j];
        Line l1 = Line.CreateBound(p1, p2);
        Line l2 = Line.CreateBound(p2, p3);
        Line l3 = Line.CreateBound(p3, p4);
        Line l4 = Line.CreateBound(p4, p1);
        List<Curve> loopSegments = new List<Curve> { l1, l2, l3, l4 };
        CurveLoop closedLoop = CurveLoop.Create(loopSegments);
        Floor.Create(doc, new List<CurveLoop> { closedLoop }, floorTypeId, level1.Id);
    }
}

 

Message 5 of 5

RPTHOMAS108
Mentor
Mentor

So you just need to get all the intersections from all the grids and order them by Y then X.

 

You have to remember though when ordering by doubles you need a row tolerance otherwise minute differences of the Y Ord will create extra undesirable rows.