# Tags using AddComponent (Location)

**URL:** <https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236>\
**Category:** Revit\
**Tags:** windows\
**Created:** [March 10, 2022, 1:15pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236 "2022-03-10T13:15:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Massimiliano\_Battist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/massimiliano_battist/32/643378_2.png) [@Massimiliano\_Battist](https://discourse.mcneel.com/u/Massimiliano_Battist)\
**Post date:** [March 10, 2022, 1:15pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/1 "2022-03-10T13:15:08Z")

</div>

Hi,

I’m trying to place tags within Rhino Inside using AddComponent and it semms ok but the tag isn’t reading the Mark of my object.  
When I place the tag manually it works fine. Do you have any idea of what is happening?

Thank you

In this image the left tag has been placed using the script and the other by me manually.

![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/7/8/8/78844f9eb1e2980a8996a2f63f16f9a61ea5fb51.png)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/5/d/45da11bb2fcada14c7bfa4a98c3abe584f53114f.png)

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [March 10, 2022, 1:35pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/2 "2022-03-10T13:35:41Z")

</div>

A tag is going to be particular to a view and the category of element being tagged. Here is a python example Ehsan did that tags a wall.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/a/5/7/a579cf4650e6f660d6e3f68de53e58796209de81.png)  
[RE\_AutoWallTag.gh](https://discourse.mcneel.com/uploads/short-url/6OWFUxOp9rMpyhUKaKQlQLets2i.gh) (16.7 KB)

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [March 10, 2022, 1:43pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/3 "2022-03-10T13:43:38Z")

</div>

Here i created a new furniture tag, queried all the furniture in the view and used their locations to place new tags.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/0/8/8/088fddb46a188eb4d45d72ff03c46765e0bd3dea.png)

---

<div class="post-metadata">

**Author:** ![AnnaAN](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/annaan/32/540378_2.png) [@AnnaAN](https://discourse.mcneel.com/u/AnnaAN)\
**Post date:** [April 2, 2022, 2:37pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/4 "2022-04-02T14:37:14Z")

</div>

Hi,  
I would like to assign room tags to Revit rooms using your Python script which worked perfectly for wall, window tags. But for rooms I need to put the tags in the centre of the rooms like Revit do this. Please look at the printscreen.  
 ![Room tags](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/6/2/462a451cb01d541d59df72c52c2e11b1b387bf8b.jpeg)

I’ve also tried to use Add Component (Location) but all parameters define in tags are missed.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/6/e/f6ec8f8f4f151b1b12e26874169355a6c1921c7c.png)

Any suggestion how to developed script also for centre location tags in rooms?

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [April 2, 2022, 8:11pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/5 "2022-04-02T20:11:14Z")

</div>

AnnaAN, Room Tags are a different bird.

See attached, one goes the adjustable room location, the other to the bounding box center.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/e/a/7/ea78b755e6c1de86fb5bac9877cb5d997b0dc7ff.png)  
[PlaceRoomTag.gh](https://discourse.mcneel.com/uploads/short-url/kVwK5Az6IkWZdAg9bJ86PGbV407.gh) (12.5 KB)

---

<div class="post-metadata">

**Author:** ![AnnaAN](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/annaan/32/540378_2.png) [@AnnaAN](https://discourse.mcneel.com/u/AnnaAN)\
**Post date:** [April 3, 2022, 2:02pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/6 "2022-04-03T14:02:20Z")

</div>

Thank you for your help and time. I’ve tested your solution but in my case the scripts didn’t work.

The first solution using Room Location gave me error: 1. ‘Room’ object has no attribute ‘Centroid’

The second solution based on Room Center have placed tags not at the center of the rooms. I have also noticed that working Room Center Python script depends on the file units (please see below printscreen\_first in meters, second in centimeters, in millimeters tags are far away from main model).

 ![RoomCenter_in meters](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/b/8/2/b82dfa65aff469edae5658b774a566d57d52133b.png)  
 ![Room Center_in centimeters](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/5/f/f5fca205e9ce7cc4e384b476684b2d4b371dcd25.png)

By the way, I have one suggestion that possibility to choose tag by name could be very helpful.

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [April 3, 2022, 2:36pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/7 "2022-04-03T14:36:06Z")

</div>

My bad on the Centroid, must not have saved.

[PlaceRoomTag.gh](https://discourse.mcneel.com/uploads/short-url/avhcVU82Um8h7Dd1V4rJ6xbvvci.gh) (12.3 KB)

I’ll have to get back to you on the unit conversion aspect.

> **[NewRoomTag Method](https://www.revitapidocs.com/2022/9847aafe-42f9-fe8e-5229-c491add7ec46.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

> [@AnnaAN](#):
>
> By the way, I have one suggestion that possibility to choose tag by name could be very helpful.

The Create.NewRoomTag doesn’t have a type overload, so referencing the tags after and changing the family type would be required.

---

<div class="post-metadata">

**Author:** ![AnnaAN](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/annaan/32/540378_2.png) [@AnnaAN](https://discourse.mcneel.com/u/AnnaAN)\
**Post date:** [April 3, 2022, 4:03pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/8 "2022-04-03T16:03:48Z")

</div>

Thank You very much for corrected file and explanation. Now Centroid version works.

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [April 4, 2022, 8:45pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/9 "2022-04-04T20:45:55Z")

</div>

Try this in your mm or meters file.

[Re\_PlaceRoomTag.gh](https://discourse.mcneel.com/uploads/short-url/b47zwXFJIDhbscb6GVssbP3BfqV.gh) (11.6 KB)

---

<div class="post-metadata">

**Author:** ![AnnaAN](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/annaan/32/540378_2.png) [@AnnaAN](https://discourse.mcneel.com/u/AnnaAN)\
**Post date:** [April 5, 2022, 10:47am UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/10 "2022-04-05T10:47:49Z")

</div>

Perfect!It works.Thank YOU again.

---

<div class="post-metadata">

**Author:** ![AnnaAN](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/annaan/32/540378_2.png) [@AnnaAN](https://discourse.mcneel.com/u/AnnaAN)\
**Post date:** [April 7, 2022, 11:49am UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/11 "2022-04-07T11:49:31Z")

</div>

Hi Japhy,  
It will be very helpfuf if output of the new room tags will be available in the component.

Is it any chance to modify in easy way pythonscript to get output?  
I will be very grateful

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [April 7, 2022, 12:57pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/12 "2022-04-07T12:57:09Z")

</div>

Non-element tracked elements output.

[Re\_Re\_PlaceRoomTag.gh](https://discourse.mcneel.com/uploads/short-url/bWzmauOHedFZjTdu9gCCV9AqSXr.gh) (13.6 KB)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/8/c/f/8cf9276a190ccdf117a350dd9a1d74c9b8112c02.png)

---

<div class="post-metadata">

**Author:** ![AnnaAN](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/annaan/32/540378_2.png) [@AnnaAN](https://discourse.mcneel.com/u/AnnaAN)\
**Post date:** [April 9, 2022, 7:17am UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/13 "2022-04-09T07:17:14Z")

</div>

Sorry for the late reply. Thank you. It works.

---

<div class="post-metadata">

**Author:** ![AnnaAN](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/annaan/32/540378_2.png) [@AnnaAN](https://discourse.mcneel.com/u/AnnaAN)\
**Post date:** [April 9, 2022, 3:38pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/14 "2022-04-09T15:38:01Z")

</div>

Is it any way to delete old tags (window, doors) when you change the type of the tag (not double it) when it is python-script?Something similiar to tracking in regular RiR components.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/0/e/8/0e87187d995905acbea5ec7c1195ef36076c78fe.png)

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [April 11, 2022, 1:17am UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/15 "2022-04-11T01:17:42Z")

</div>

Hi AnnaAN, Is there any reason you wouldn’t query the same view and change they Type via Native components?

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/6/b/a/6ba18f6de8f4a4977bdb2c581c5025f63d3124e7.png)

---

<div class="post-metadata">

**Author:** ![AnnaAN](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/annaan/32/540378_2.png) [@AnnaAN](https://discourse.mcneel.com/u/AnnaAN)\
**Post date:** [April 14, 2022, 2:30pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/16 "2022-04-14T14:30:53Z")

</div>

Thank You but I would like to remove only those elements that were created using the python script, not all contained in the drawing.Especially the problem is with Python Text Script.

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [April 14, 2022, 6:51pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/17 "2022-04-14T18:51:18Z")

</div>

AnnaAN, Scripted Tracking isn’t available yet, that will be a feature in Rhino.Inside.Revit 2.0 API

In your definition above you are collecting all Windows in the project but only applying the tag per View. Its creating tags for each window, where the the non-visible ones are out there somewhere.

See below for using just the view.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/f/d/ffd7e3c54c422e92ef6645d565e538e6c080cbb5.png)

What is different about the ones created in the Python Script?

We can do pseudo tracking a few different ways, each has benefits and pitfalls.

Store a value as a parameter in Revit.  
Store a value in the GH document (which looks like you started doing)  
Hold a collection of IDs in the Python Script.

---

<div class="post-metadata">

**Author:** ![Fernando\_Rey](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fernando_rey/32/491394_2.png) [@Fernando\_Rey](https://discourse.mcneel.com/u/Fernando_Rey)\
**Post date:** [February 20, 2024, 12:24pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/18 "2024-02-20T12:24:12Z")

</div>

Hi @Japhy, thank you for sharing this information. By any chance have you worked on a similar code but for keynotes instead of tags? It would be very helpful.  
Thank you,

---

<div class="post-metadata">

**Author:** ![Japhy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/japhy/32/487647_2.png) [@Japhy](https://discourse.mcneel.com/u/Japhy)\
**Post date:** [February 20, 2024, 3:00pm UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/19 "2024-02-20T15:00:13Z")

</div>

Hi Fernando,

There isn’t a keynote component, these are slightly different than an independent tag, see this [post](https://forums.autodesk.com/t5/revit-ideas/keynote-creation-via-api/idi-p/8658368) for more details.

---

<div class="post-metadata">

**Author:** ![Hayden\_Payne](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/hayden_payne/32/641024_2.png) [@Hayden\_Payne](https://discourse.mcneel.com/u/Hayden_Payne)\
**Post date:** [March 5, 2024, 2:06am UTC](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236/20 "2024-03-05T02:06:03Z")

</div>

Hi Japhy,

I have just tried to follow the above to tag structural columns in a number of sections and it doesnt seem to work. What do I need to alter to tag all the structural columns within multiple revit sections?

[Next page](https://discourse.mcneel.com/t/tags-using-addcomponent-location/139236.md?page=2)
