<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A' in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251354#M26448</link>
    <description>&lt;P&gt;Here is a partial sample from a method I use to update linked room, but it could be adapted pretty quickly for rooms to spaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;foreach(Room room in Rooms)
						{
							if(room.LookupParameter("Linked Room GUID") is Parameter lGUID &amp;amp;&amp;amp; room.LookupParameter("Link Name") is Parameter LinkName)
							{
								Document linkDoc = null;
								if(links.TryGetValue(LinkName.AsString(), out linkDoc))
								{
									if(linkDoc.GetElement(lGUID.AsString()) is Room linkRoom)
									{
										string linkName = linkRoom.get_Parameter(BuiltInParameter.ROOM_NAME).AsString();
										string LinkNumber = linkRoom.Number;

										room.Number = LinkNumber;
										room.get_Parameter(BuiltInParameter.ROOM_NAME).Set(linkName);
										itemCount++;
									}
									else
									{
										if(MessageBox.Show("Linked Room '" + room.Name + "' could not be found." + Environment.NewLine + "Would you like to delete the Room?", "Room Not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
										{
											doc.Delete(room.Id);
										}
										else
										{
											room.Unplace();
										}
									}
								}
								else
								{
									MessageBox.Show("Link '" + LinkName.AsString() + "' could not be found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
								}
							}
							else
							{
								MessageBox.Show("Linked Room parameters are missing from this Document.", "Missing Parameters", MessageBoxButtons.OK, MessageBoxIcon.Information);
								t.RollBack();
								return Result.Cancelled;
							}
						}&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 19 Apr 2021 18:08:06 GMT</pubDate>
    <dc:creator>Sean_Page</dc:creator>
    <dc:date>2021-04-19T18:08:06Z</dc:date>
    <item>
      <title>Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10250748#M26445</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working in an MEP design office on the Revit API as a developer and am looking for a way to identify/retrieve rooms of a model (version B) from rooms of the same model (version A).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To be more precise, we are currently creating spaces in our active model from the architect's rooms (linked model).&lt;/P&gt;&lt;P&gt;Then to identify my spaces, I use the ID parameter values that the architect provides in his model.&lt;/P&gt;&lt;P&gt;When a new version of this model is received, in order for my spaces to match the new rooms, I have to delete my spaces and generate them again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my problem: Between two versions of the model, the architect often changes the identification nomenclature of his rooms. For exemple for a given room, it can be "R_001" (version 1) and "R_01_A" (version 2)&lt;/P&gt;&lt;P&gt;How to deal with these changes of identification.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Under these conditions, I cannot trust the ID parameter, so switching from a version A model to a B version is very difficult, without looking at the differences between the two versions of the model on a case-by-case basis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you ever faced this problem ? What could be my options ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Attached is a screenshot that shows the problem with a simple use case.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your answers&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 14:48:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10250748#M26445</guid>
      <dc:creator>mathieu.josserand</dc:creator>
      <dc:date>2021-04-19T14:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251278#M26446</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is a interesting problem! i think a good approach is to update you space's informations instead to delete and generate them again. Here my thinking..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.get your spaces&lt;/P&gt;&lt;P&gt;2.get the location of your spaces (space.Location)&lt;/P&gt;&lt;P&gt;3.get the link document of the architect Revit file.&lt;/P&gt;&lt;P&gt;4. from your list of points, use getRoomAtpoint (&lt;A href="https://www.revitapidocs.com/2020/656d34c2-1e53-7278-ab83-fefaff7f40a4.htm" target="_blank"&gt;https://www.revitapidocs.com/2020/656d34c2-1e53-7278-ab83-fefaff7f40a4.htm&lt;/A&gt;) on the link document. You should have a list of architect's rooms.&lt;/P&gt;&lt;P&gt;5. collect the info from rooms, then update your spaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 17:46:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251278#M26446</guid>
      <dc:creator>Yien_Chao</dc:creator>
      <dc:date>2021-04-19T17:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251320#M26447</link>
      <description>&lt;P&gt;I have done this very same thing and the best way to do this is to use the Room.UniqueId and not the ElementId. The GUID will stay constant even if the model is versioned 100 times as long as it is based on the same original model. This is very important when working in Workshared environments as the ElementId can change often.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think if you were to refactor for this then you could compare the two quite easily and make any changes needed or even just use the latest one, get the Rooms out of it using the GUID (make a room param and "store" this information) and update your spaces as needed.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 17:56:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251320#M26447</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2021-04-19T17:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251354#M26448</link>
      <description>&lt;P&gt;Here is a partial sample from a method I use to update linked room, but it could be adapted pretty quickly for rooms to spaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;foreach(Room room in Rooms)
						{
							if(room.LookupParameter("Linked Room GUID") is Parameter lGUID &amp;amp;&amp;amp; room.LookupParameter("Link Name") is Parameter LinkName)
							{
								Document linkDoc = null;
								if(links.TryGetValue(LinkName.AsString(), out linkDoc))
								{
									if(linkDoc.GetElement(lGUID.AsString()) is Room linkRoom)
									{
										string linkName = linkRoom.get_Parameter(BuiltInParameter.ROOM_NAME).AsString();
										string LinkNumber = linkRoom.Number;

										room.Number = LinkNumber;
										room.get_Parameter(BuiltInParameter.ROOM_NAME).Set(linkName);
										itemCount++;
									}
									else
									{
										if(MessageBox.Show("Linked Room '" + room.Name + "' could not be found." + Environment.NewLine + "Would you like to delete the Room?", "Room Not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
										{
											doc.Delete(room.Id);
										}
										else
										{
											room.Unplace();
										}
									}
								}
								else
								{
									MessageBox.Show("Link '" + LinkName.AsString() + "' could not be found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
								}
							}
							else
							{
								MessageBox.Show("Linked Room parameters are missing from this Document.", "Missing Parameters", MessageBoxButtons.OK, MessageBoxIcon.Information);
								t.RollBack();
								return Result.Cancelled;
							}
						}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Apr 2021 18:08:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251354#M26448</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2021-04-19T18:08:06Z</dc:date>
    </item>
    <item>
      <title>Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251588#M26449</link>
      <description>&lt;P&gt;Thank you for the pertinent question and the very helpful answers. I like them all very much. For a radical approach, you can also think about creating your own key for the rooms:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2012/03/great-ocean-road-and-creating-your-own-key.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2012/03/great-ocean-road-and-creating-your-own-key.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This requires you to decide for yourself what actually identifies the room. For instance, it might be its approximate geospatial location. Encode that identification digitally somehow, implement a normalisation of the encoding, and use that as your own truly relevant personal identifier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For practical use in this case, though, the unique id should probably be fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 19:36:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10251588#M26449</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-04-19T19:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10253807#M26450</link>
      <description>&lt;P&gt;Thank you all for your answers. It makes me think a lot about all these options...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I delete my spaces for geometric considerations. Because if the shape of the room changes, or shifts, well it's not possible to change the boundaries of the space without deleting it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot trust the GUID parameter because, to update rooms, architects use to delete the room object to generate another one...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my opinion, there are several cases that we need to handle differently.&lt;BR /&gt;And for these reasons, I think it is better to create my own key/id =&amp;gt; i.e : my own "internal nomenclature".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The initial situation is as follows:&lt;BR /&gt;I keep my current spaces, unload the linked model, and load the new one.&lt;BR /&gt;In this situation, my spaces of the old linked model are still active. (-- some shifts can be observed between the old_spaces and the new parts once the new model is loaded (V1_loaded.jpg and V2_loaded.jpg)).&lt;BR /&gt;Now let's compare them to the new parts...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First case (case_1.png):&lt;BR /&gt;The old space (Id: 1171) is divided into 4 rooms (Id: 1817, 1818, 1819, 1820).&lt;BR /&gt;So, from a space perspective, if I use .GetRoomAtPoint(old_spaceLoc), I will only get the room "1819 id" according to my image (case_1.png).&lt;BR /&gt;My solution here would be to browse the room collection, and for each room_i, look at the corresponding old space.&lt;BR /&gt;Here, for room_1817, room_1818, room_1819, and room_1820: I use .GetSpaceAtPoint(room_18XX).&lt;BR /&gt;And finally, if I see that for an old_space, I get several parts =&amp;gt; ok I guess there are new rooms, so new keys/ids for my internal nomenclature.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for case_1, the solution is to create new keys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second case (case_2.jpg):&lt;BR /&gt;-- This case is a bit confusing... I am doing my best to be clear in my explanations...&lt;BR /&gt;Working on the new Sanitary Space (highlighted in yellow) against the old Sanitary Space (highlighted in red).&lt;BR /&gt;As you can see, going from V1 to V2, creates an upward shift...&lt;BR /&gt;From a "new room" perspective: if I use .GetSpaceAtPoint(yellow_roomLoc),&lt;BR /&gt;I'll get an old_space !!! but a bad one =&amp;gt; the big blue space on top doesn't match my small sanitary&lt;BR /&gt;And if I mix these two space ids, it's a mess&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I imagine a second check before assigning any id,&lt;BR /&gt;if the (old) returned space NAME and the (new) room&amp;nbsp; Name are equals, AND the area of the returned space is equivalent (+- 5 square feet, say) to the area of the room&lt;BR /&gt;I assume that the space and the room match each other, so I assign the same (internal) key/id.&lt;BR /&gt;If the surfaces are different, I use a new key/id to store the new space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To conclude, I think it's better to manage your own space keys.&lt;BR /&gt;To update your linked model, and identify as many spaces as possible from the new rooms,&lt;BR /&gt;You need to go through the Room Collection, save a transco table between &amp;lt; own_key, new_room_id &amp;gt;,&lt;BR /&gt;Delete the old_spaces, generate the new spaces, and assign them their key according to their new_room_id.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- With this process, you can easily update the geometry of spaces, keep your space data, and then accurately identify the new spaces with your newly generated internal keys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:45:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10253807#M26450</guid>
      <dc:creator>mathieu.josserand</dc:creator>
      <dc:date>2021-04-20T14:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10253810#M26451</link>
      <description>&lt;P&gt;Here, the last pic =&amp;gt; the case_2.jpg&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 14:25:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10253810#M26451</guid>
      <dc:creator>mathieu.josserand</dc:creator>
      <dc:date>2021-04-20T14:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10253995#M26452</link>
      <description>&lt;P&gt;Interesting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, this does look like a case for implementing an own key of some kind. If the rooms are always axis-aligned rectangles, it is very simple: just implement a canonical ordering of the data structure (lower_left_corner, upper_right_corner). To implement it for arbitrary closed polygons is harder, but not very much. For instance, assuming straight edges, you could implement an ordering using something like (number_of_vertices, list_of_vertex_coords). And so on...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also use a 2D Boolean operation library to check which of the existing rooms in a previous version has the larges overlapping area with a given new room in the updated version.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 15:17:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10253995#M26452</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-04-20T15:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10254041#M26453</link>
      <description>&lt;P&gt;Are the "ID" numbers your showing Room Numbers or Revit ElementIds?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would still argue the UniqueId is going to be the best / safest bet here. Although the Architects may delete rooms, they may also just be unplacing them, and then placing them again if they are using them correctly. This may produce a new ElementId, but the GUID would be constant.&amp;nbsp; In my app if I come across a GUID that no longer matches anything, or isn't placed then you can provide that as a pop up and the user could go update one or two rooms that my have broken.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would also say you shouldn't be deleting and recreating spaces for each run as you would be loosing any data that has been set.&amp;nbsp; I think there are also some inbuilt tools for Revit that allow you to associate Spaces to Rooms if they are IN the rooms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could also take a look at my git for some reference. I do not have the "update" feature shown here because its a simplified example, but the Linked Views tool does have an update feature that would be similar for reference on the Git.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/TorsionTools/R20" target="_blank" rel="noopener"&gt;TorsionTools/R20: Autodesk Revit 2020 API Visual Studio Solution Template with Code Examples for Common Tools (github.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Apr 2021 15:32:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10254041#M26453</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2021-04-20T15:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Identify rooms in a architect model 'version B' from rooms of a architect model 'version A'</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10255812#M26454</link>
      <description>&lt;P&gt;I would definitely trust Sean's solution and any of his suggestions a hundred times more than my untested theoretical assumptions! Thank you, Sean, for your great support and sharing your experience!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2021 07:55:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/identify-rooms-in-a-architect-model-version-b-from-rooms-of-a/m-p/10255812#M26454</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-04-21T07:55:40Z</dc:date>
    </item>
  </channel>
</rss>

