Room Tags in Section View

Despite searching the forum, I couldn’t find a clear explanation of how to place Room Tags in Section Views using Dynamo. Is there a workflow or node setup that allows tagging rooms in section views? Create Annotation Tag ( Genius Loci) works only Floorplan. Any guidance or examples would be greatly appreciated. Thank you!

Why not use Tag All?

What Revit version do you use?


Tag.ByElementAndLocation - R25

Hi @bvs1982 . I have 50 Section View.:slightly_smiling_face: .

I tried it, but it didn’t work. May be it sproblem at location.

Did you try it on one View?

Node Name: Tag.ByElementAndLocation
Original Node Name: Tag.ByElementAndLocation
Package: Revit.Elements.Tag.Create
Dynamo Version: 3.3.0.6316
Host: Dynamo Revit
Messages: Tag.ByElementAndLocation operation failed.
There is no loaded tag type that can be used when tagging referenceToTag with tagMode.
State: Warning

That node works with Tag by Category.
Do you have Room Tag in your project?

Yes

Hello @jacob.small , @sovitek , @c.poupin , @Nick_Boyts
Is there a solution to this problem? Thanks

Hi @yaseminV2XL5 i always use genius or similar for room and spaces and should in sections as well, whats the issue exackly

Hi @sovitek .I am trying to automatically place Room Tags in Section Views using Dynamo

yeah sure :wink: but does the genius loci give any warning or something or is it just a null…and when in section view can you then see the location blue dot for placement ? when preview is on ?

@yaseminV2XL5 if the Genius Loci nodes aren’t working try taknig them apart, but it’s somewhat likely that the Python Engine isn’t supported anymore (that package never updated to a Python 3 version) which means you have to decide if you want to add another security vulnerability to the mix by installing IronPython2 (I wouldn’t) or if you want to own your own Python based solution.

yeah right but for that node just set it pythonnet 3 and works if i remember, and then oc need pythonNet 3 version 1.1.1 installed as well

ps @yaseminV2XL5 it shouldnt be the engine for you if it work for you in plan, but nice to know what Jacob say :wink:

Hi,
It is necessary to compute the UV coordinates from the section view.

import clr
import sys
import System
#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary, HashSet

clr.AddReference("System.Numerics")
#
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument


toList = lambda x : x if hasattr(x, "__iter__") and not isinstance(x, (str, System.String)) else [x]

#Preparing input from dynamo to revit
lstViews = toList(UnwrapElement(IN[0]))
tags = []
TransactionManager.Instance.EnsureInTransaction(doc)
for view in lstViews:
    origin_view, right_view, up_View = view.Origin, view.RightDirection, view.UpDirection
    
    rooms_inview = FilteredElementCollector(doc, view.Id).OfCategory(BuiltInCategory.OST_Rooms).WhereElementIsNotElementType().ToElements()
    for room in rooms_inview:
        bbx = room.get_BoundingBox(None)
        center = (bbx.Min + bbx.Max) / 2
        vector_origin_center = center - origin_view
        u_coord = vector_origin_center.DotProduct(right_view)
        v_coord = vector_origin_center.DotProduct(up_View)
        uv = UV(u_coord, v_coord)
        tag = doc.Create.NewRoomTag(LinkElementId(room.Id), uv, view.Id)
        tag.TagHeadPosition = center
        tags.append(tag)
        doc.Regenerate()
TransactionManager.Instance.TransactionTaskDone()

OUT = tags

@yaseminV2XL5 you are going to struggle with OOTB and package nodes. Although the Genius Loci node is capable of tagging rooms with a RoomTag in a section - it does not move the tag afterwards in the view Z direction. There are currently no nodes that can move a RoomTag in a section view that I could find. In this instance work with @c.poupin’s code

genius loci should have a node we can use after guess its called tag set location or something


Home.dyn (10.9 KB)

I stand corrected @sovitek :person_bowing:
Here’s an example graph (note the Z adjustment is feet)

Here’s how you can do it with amended Genius Loci nodes and avoid the tut-tutting of Jacob
Crack open the Create Tag custom node (Right click > Edit Custom Node) - you may get a warning, keep going. Use <ctrl> + L to clean up the layout
Change the LinkIntance Input node to linkInstance

    

Set the Python Script node to PythonNet3 via right click on node (Do this for Tag GetLocation and Tag SetLocation as well)

I did have the issue of the linkInstance port not being set to ‘default’ - if this is so, right click and set to default (null)

Now you are ready to go