Hello Jacob, thats in fact the method I´m starting with, but there is so much else to do
At this moment i got nearly everything working with Revit.DB, had a hard time and would be very interrested in your thoughts about my methods. Questionable workarounds with question marks.
- Get floor solid with f.get_Geometry(opt)
- Scale Floor Solid with SolidUtils.CreateTransformed(scaledSolid, transform)
- Get Walls with ElementIntersectsSolidFilter(s)
- Get wall solid with w.get_Geometry(opt)
- Intersect with BooleanOperationsUtils.ExecuteBooleanOperation(floor, w, * BooleanOperationsType.Intersect).Volume to drop walls that are intersecting too little
- Get floor centroid with s.ComputeCentroid()
- Get 2 largest wall faces by s.Faces and sort by area
- Get nearest wall face for every wall by w.Project(floor).Distance
- Get vertical floor faces with s.FaceNormal.Z ==0
- Filter floor faces by edges that have length=floor hight
Now it gets interresting at finding the wall face for every floor face.
- Get all Face normal vectors by x=f.FaceNormal
- Match parallel wall and floor faces
- Get floor faces center by x=face.GetEdgesAsCurveLoops(), y=z.GetPlane(), center= y.Origin ???
- Pull floor face centerpoints on wall faces by wall.Project(point).Distance and use distance to match a floor face to every wall face
- Get lines from floor faces by w.GetEdgesAsCurveLoops() and y=u.ToProtoType()
- Switch to Dynamo geometry, lines to Polycurve, surface by patch, use U/V parameter 0/0.5 and 1/0.5 to get centerline on floor face.??? , thats where the family will be placed
- Back to Revit Geometry, pull start/endpoint of line on wall face by w.Project(p).XYZPoint
- finally place family by doc.Create.NewFamilyInstance(f,p,v,family)
There is for sure potential to make some things better, for example, can i get the distance between 2 faces?