Dear Graham,
Thank you for your patience.
The development team finished analysing your issue REVIT-127340 [API space boundary differs from UI -- 13927409] and say:
A.
This is an excellent reproducible case!
I reproduced the issue and investigated the code a little bit. It seems that the root cause has to do with the topology of the room. The API function called to retrieve the segments depends on the previously computed topology.
To trace the code, I put in breakpoints and ran the macro. I also changed the dimension from 300 to 310 and back.
I traced how the topology is computed...
I can see that depending on the position of the stand-alone wall (which is offset by either 300 or 310 mm) the topology switches between two components and three components. It looks to me like the stand-alone wall produces a possibly degenerate two-segment circuit that is sometimes combined with another circuit to make a circuit with six segments.
Since the algorithm has many cases (needed to support different kinds of geometry) and includes tolerances and performance optimizations, I think that fixing this issue should be classified as an improvement.
B.
Actually, there is no difference between boundaries used by the UI and API. The boundary is less than ideal due to the 1ft (about 300mm) gap closing tolerance. The space in the model here also has those overlapping lines on the left side of the "islands" except they are not displayed in 2D view. Internally the same code provides the boundary curves to the Space/Room elements as the one used by the API.
Nothing really to fix here, except the old problem of the 1ft tolerance. That has been reported numerous times and waiting in our backlog to gather enough support.
I therefore closed this issue now as 'Won't Fix'.
I hope this clarifies.
You might want to add your support to the Revit Idea station wish list item to modify the 1ft tolerance mentioned above, or create such a wish if none yet exists.
Cheers,
Jeremy