Automating Taggin with avoiding clashes

Hi Colleagues,

I am trying to create dynamo, which will automatically place the tags with avoiding the clashes on the floor plans, clashes with tags itself, created assemblies + MEP (from external models) I have couple of issues, I created the tags (center of the assembly) on the floorplans, which are placed on the sheets . In relation to this I decided to create Cuboid based on dimensions of the tag, I do not know now how to prepare the boolean to filter tags, which are intersection each other and those, which are not. Please focus on the upper part of the script, script will be for tagging Assemblies (Mechanical Equipment - upper part) and Assemblies (Speciality Equipment - lower part, probably will be just copy/paste), which are presented on different sheets with different tag families.

In general, do you think is that possible to solve that issue with just dynamo? In general my plan is.

  1. Create tags (center of assemblies)
  2. Change position of the tags to not cover assemblies
  3. Move the intersecting tags, really important to mention I do not want to change their location by defining vectors (x,y) manually, but automatically. I am thinking to create grids (just for that case) with offset every lets say 5 mm (grids(y) and grids(x)) and based on that searching with a dynamo best position to place tag with avoiding clashes with above mentioned issues.
  4. I would like to add another condition at the end with avoiding clashes with MEP + above 3 points.

Looking forward to hearing from you!

1 Like

I realize this doesn’t have all the features you mention, but you might take a look at the Align plug in. It’s free and can help with tag management.

That said, odds are you have set yourself with a very tall order. I’ve thought of tackling this task a few times, but it seems like it would end up being rather complicated, and we try to limit our tagging as much as we can at this point, so I’ve never bothered to spend my time on it.

Before we get started - This will almost probably run faster if you can reduce everything to 2D geometry instead of 3D. Also you’re probably going to need to find some custom nodes people have made to check for intersections. I’m not aware of any that come with Dynamo, but also I write mostly in code at this point so there might be one and I just don’t know of it.

Based on what you already have set up, my thought would be to cycle through every created cuboid and check if it’s intersecting with any other cuboid. Or perhaps you could do this as you place them, that might be better actually. Then if it’s intersecting, find the nearest grid point (assuming you set up a grid) that is outside of the cuboid that’s staying, and shift the corner/edge one you’re moving to that point.
If you’re doings this after they’re all placed, check again and repeat until they’re no longer intersecting. Maybe put a limit on how many times to try before it gives up.
If you’re checking for intersections as they get placed, then you just continue on after they’re clear of each other.
This is just talking about tags not colliding with each other. You’ll have to also do this concurrently with making sure both the leader lines do clash with each other, and make sure the tag heads don’t clash with the 2D geometry on the page. Which, I don’t believe we are given a way to pull the leader lines from the tag, so you’ll have to recreate those yourself, and I’m not sure if there’s a way to pull 2D geometry from a view into Dynamo, but it would make sense if there was I suppose.

I’m sure there’s someone out there who specializes in sorting algorithms, and maybe they would think this task is easy, but to me it seems like this is going to get pretty complicated pretty fast. So best of luck! I’ll be keeping my eyes on the thread.

1 Like

White space detection is high on the list of what I call computational ‘holy grails’. This is what I use to describe problems which are very difficult to solve, or require so many variables or computational power that they wont scale to other scenarios well or aren’t achievable with today’s technology in a timeable manner.

Another example of this is how to write code which can detect when it will crash your program and not run or take an alternative pathway (you can build ways to guess code wont run and needs to be stopped, but how does one know this with certainty), or turning shadows into vector outlines when complex site models are involved (we usually resample to pixel grids and run shadow tests on them instead).

What makes this specific grail so difficult to determine is that you effectively have to look at everything in the model to form an overall amount of space left over, and after that one by one you need to find spaces for the tags to sit, taking into account you need to reverse engineer tag size based on view scale so they’re comparable to model elements. At a certain point the task just becomes too hard to solve due to all the possible ways this could go wrong (e.g. if you run out of white space, or if the tags don’t align nicely once they find white space). At some point a human’s judgement is needed - computers do not appreciate aesthetics, only instructions.

I second Stewart’s idea that tools to assist with quick layout and placement of tags are the most suitable approach here.


Optimizing Room Tag Placement with Generative Design, DynaShape and VASA - Dynamo BIM


Hi Colleagues,

Thank you for your response!

In my case I cannot limit the amount of tags, one time I spent one week just on tagging elements on floor plans, that is why I decided to face the problem. Yes, it is hard and I understand the complexity of the problems, which have to be taken into consideration.

@stewart.skyler I made step with creating 2D objects in the model, even when I placed z=0, they do not cover each other in some cases, some of them are on different levels, slight differences, but still (intersection node could not detect it), that is why I decided to create cuboid objects to make sure myself that everything, what should be covered is covered. Also if I would like to take into consideration collapsing tags with the model of MEP (which is in 3D), I will need to work with 3D object sooner or later.

Thank you for mentioning leaders, that is another problem I can face in the future, but my first step is trying to solve problem with intersecting tags. I will check the Align plugin, which seems quite interesting from this what you said.


[quote=“GavinCrump, post:3, topic:78605”]
taking into account you need to reverse engineer tag size based on view scale so they’re comparable to model elements.
[/quote] Could you please explain it more?

In general in my case, just to make the script faster, I am unloading models, which I am considering as a necessary (Architectural + Structural), I do not care if the tags will cover walls/structural beams etc., so bigger amount of space + less calculating power to use. In general yes, task is really challenging and complicated, but with defining limitations by setting grids I think can be possible, but I am not sure if nodes of dynamo are enough, probably support from programming side of using Python can be needed, but I judge my skills as a not enough (at least for now :smiley:)

@Vladimir Thank you for sharing the topic.

And in summary thank you for sharing the knowledge I am going to try this plugin as well.

That part of my post means that a tag is not scaled to model space, it is scaled to sheet space. Your script would need to consider tag size in relation to model space if you are looking for white space between model elements in addition to other 2d elements.

1 Like

did you ever resolve this? I am looking for that solution to relocate tags in smart locations that do not hide model elements or other annotative elements in views

This blog post from @john_pierson shows one way this can be accomplished: Optimizing Room Tag Placement with Generative Design, DynaShape and VASA - Dynamo BIM

1 Like

These days id consider looking into a workflow such as temporarily exporting the view as an image, assessing it externally for white space and then using the findings instead. Ive never found a need for this workflow so havent explored it. People always place tags better than programs in my experience.

I believe the Glyph addin by evolvelab deals with this but unsure how.


I recall they are using some AI on processed 2D data from the view. VASA is effectively doing the 2D data processing for you, the next bit is finding the closest point to the ideal, which means you first need to know the ideal (see the other thread @RubenVivancos started) and then you try and always fit the tag closest to said point using your algorithm of choice. In John’s case that was relaxation (via DynaShape) plus a generic algorithm (NSGA2 via Generative Design). Not sure what Glyph uses.

1 Like

I agree but the intention is to create views with the needed contents and hopefully do not move the annotative elements much around, if the tags are fully created by script and there is no existing tags in views so I can guess a good place to place them but it may not work in overall after the efforts.

I am trying to see how is done in that example with tag rooms avoiding clash with objects in the view, but first problem is that even loading the packages provided, dynamo do not load them in Dynamo 2.13 version:

Haven’t had this issue. Which packages won’t install?

all of them, I copied the packages folder entirely and do not load, if there are no packages installed and I try to install from Dynamo, it loads some of them but not all, some nodes appear not connected already.

I am trying on Revit 2023 which comes with Dynamo 2.13

You’re missing some Revit updates, as a first step I would look into getting those installed.

After that, clear your current packages folder for 2023 (or just rename it), relaunch Dynamo, open the preferences and make sure you’re only using the default directories - remove any additional ones. Then restart Revit if you had to remove paths, and install the packages manually from the package manager. Be sure you are getting 2023 versions where required (ie. Archi-Lab).