Change the Position of Block Tags/Attributes

Hi everyone, I hope you are all well. Could someone please tell me if it is possible to change the position of each tag/attribute via Dynamo?

In practice: Dynamo selects all the blocks, retrieves the list of tags for each block, gets the coordinates of each tag, changes the coordinates, and updates the block via “attsync.”

The problem is that the blocks have different names. So, in practice, and manually, I would have to update them one by one. In theory, they have the same drawings, the same information, the same format, but with different block names. The idea with Dynamo is to select all the blocks that have the same “pattern” and update the tag positions to the correct position for this project.

I am attaching the DWG and the Dynamo routine that I have managed to create so far, which selects the blocks of interest and retrieves the list of tags.

Obviously, you can use any new coordinates as examples.

If anyone can help me, I would be especially grateful!


ChangePositionTags.dyn (17.0 KB)
ChangePositionTags.dwg (4.5 MB)

Not entirely sure what you’re after, but I think you need to process a list of strings in the String.Contains rather than a single value.

  1. Build a list of all the strings you want to search for with a List.Create and a few string nodes.
  2. Wire the list into the “SearchFor” input of the String.Contains node. Configure the inputs of so that the string input is set to @L1, leaving it on auto lacing. You should now have a list of boolean values that is as long as the list of strings you want to search for, for each block (so the objects the node has will be the block_count * search_string_count).
  3. Wire the String.Contains node into a List.TrueForAny node, which will identify if a list has a True value. Set the input to be @L2 to ensure things pick up completely.
  4. Wire the List.TrueForAny node into the bool input of the List.FilterByBoolMask node. Proceed as before.

Jacob, thank you so much for your response. But that’s not what I need. Sorry if I wasn’t clear in my question. I’ll explain my problem, so it might become clearer. Maybe my way of thinking about solving it isn’t ideal and is causing confusion.

Problem: I need to update the position of the tags/attributes of the blocks. For example, if the “codigo” tag is at the coordinate 100.000;50.000, I need it to be at 200.000;100.000. This “I need it to be” will be manually inserted into the Python code (I imagine I can only solve this problem via a Python script. But if there’s an option to solve the problem using only nodes, that would be ideal).

So:

  • For the “codigo” tag, I want the coordinate to be “200.000;100.000”.
  • For the “area” tag, I want the coordinate to be “210.000;110.000”.

My question, therefore, is not about the filters. It is solely about collecting the coordinates of the tags in my block and updating them to another coordinate that I specify, for each tag in my block.

So every “codigo” wants to be moved to 200; 100, and every “area” wants to be moved to 210; 110?

That’s right, Jacob. In the routine example I provided, I have already performed the filtering. For instance, I want all tags named “codigo” to be at coordinates 200;100. All tags named “area” should be at coordinates 210;210.

Remember that these are blocks with different “blockname”, hence the Dynamo solution for this case.

In that case you likely have a list somewhere of what the name and coordinates should be - perhaps a CSV or excel. Load that into Dynamo and use it to gather the block instances, and then set the coordinates accordingly.

Something like this:

  1. Import Excel
  2. Get the blocks by name
  3. Get the block references from the blocks
  4. Set the coordinates to the associate values (the sublist of block references should get the value at the matching index - so @L2 and @L1 list levels respectively)

I believe you understand what I need, Jacob. I have an idea of how it could be done. The problem is how to do it, haha. My idea of how it could be done consists of:

  1. Getting the list of blocks
  2. Getting the attributes/tags they contain
  3. Getting the coordinates of each attribute, of each block
    3.1 For all attributes/tags named “codigo”, update the coordinates to 200;100
    3.2 For all attributes/tags named “area”, update the coordinates to 210;110

The problem is how to do this in practice. I can’t find the node that does this for me, nor do I know how to do it using a Python script. But just to be 100% sure of my problem, below I will illustrate better with images what I need.

These are the attributes, in the “original” form

And then I need, through Dynamo, to make the positioning adjustments so that they look like this