Changing Space.Location causes exception "Unable to find RoomElem handle"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm writing an app to help manage MEP spaces when architectural changes have occurred to rooms in a linked model.
In a scenario where a room has moved to another part of the project, I've determined the location point of the room (translated to the coordinate system of the MEP model), and want to change the location property of an MEP space to match that of the room.
The only way I can see to do this is to retrieve the Location of the space as a LocationPoint, and then set this to the desired XYZ point, as below. In the following code, space is an MEP Space, newLocationPoint is an XYZ object.
LocationPoint spaceLocation = space.Location as LocationPoint;
spaceLocation.Point = newLocationPoint;
This does move the space to the correct location, but it also throws an exception with the message "Unable to find RoomElem handle". I don't understand what this exception means, can anyone clarify? Can I simply catch the exception and carry on or am I doing something wrong that I need to address?
Thanks.