First time here? Check out the Help page!
1 | initial version |
OK, so it was late last night and I was tired. A little more digging this morning led me to try the following:
for surface in model.getSurfaces():
adjacent_surface = surface.adjacentSurface()
if adjacent_surface.is_initialized():
print(surface.name())
print(adjacent_surface.get().name())
Lo and behold, this provides the right solution. The issue was not so much with "get" or "name", but rather with the "if" statement. The "not None" approach allowed even an uninitialized adjacent_surface to be subjected to "get" or "name", and that obviously had to fail. The "is_initialized" approach prevents that. I guess I was misled by the "Ruby-empty" to "Python-Null" similarity. It also makes me wonder now whether I should use a "Ruby-is_initialized" rather than "Ruby-.empty?" approach, but that's another discussion.