Search code examples
revit-apirevit

Revit: Why is my wall BoundaryBox not Coinciding with its LocationCurve?


Using Revit API, I split a wall in 3 parts. To do that, I create 3 Lines:

Line.CreateBound(p1, p2)
Line.CreateBound(p2, p3)
Line.CreateBound(p3, p4)

Then I create a wall with each of these lines, which are consecutive and aligned. The result isn't as expected, as the third wall is overlapping the second one, see the illustration below.

Overlapping wall

Now, this could be a programming error, but I print the Lines' end points just before creating the 3 walls, and these points are perfectly consecutive, in the right order. The print looks like this (I remove the Y and Z coordinates, they're constant):

Now creating a new wall, from (11.811023622, ...) to (17.388451444, ...)
Now creating a new wall, from (17.388451444, ...) to (18.044619423, ...)
Now creating a new wall, from (18.044619423, ...) to (28.871391076, ...)

If I then use the RevitLookup Addin to check that problematic wall, I see that its LocationCurve's origin is indeed located at (18.044619423, ...). But if I look at it's BoundingBox Min and Max properties, I can see that it starts at 17.388.. and goes up to 28.871391076. That is what the illustration shows..

Furthermore I use this split method on some other walls in my geometry, for which I have no problems, and I do obtain 3 nicely consecutive walls!

My question therefore is: Am I missing a property somewhere that would somehow 'shift' the wall BoundingBox from its Location Curve?? That would explain somehow this behavior? How else could I explain and correct this?

Thanks a lot! Arnaud.


Solution

  • EDIT: Using WallUtils.DisallowWallJoinAtEnd function did the trick!

    So this is the status after some investigation: The third wall is indeed auto-expanding its BoundaryBox so that it connects to the first wall. And doing that, it overlaps the small wall (see "wall 2 in the picture below - this wall is of different type than walls 1 and 3 (which are of same type), hence being ignored when wall 3 is looking for somewhere to connect) in between them (that was only 20cm long). Making "Wall 2" a bit longer (40 cm) helps and prevents the 3rd wall from auto-expanding to the first wall, that is what I did here:

    Walls not overlapping or auto-expanding

    Then it's ok. But this doesn't solve the problem. I didn't see any way of preventing the "auto-expansion" of the BoundingBox, or any way to control the max distance at which it looks for another wall.

    I also tried first imposing 3 different types, and then changing wall type of wall 3 to the same wall type as wall 1: when their wall types are different: no expansion. When I change the wall type, it expands, even though the wall was already created.

    Finally, the really strange behavior is that for some walls, I don't have this problem at all. This is: 3 walls of the same types as when I do have the problem, with same length of 20cm for wall 2. This last thing is really unexplained.