Copy elements and associated tags

The title says it all.

I use Clockwork’s Element.CopyByVector all the time for large amounts of Revit elements and I want to copy the tags along with the element.

It’s easier said than done. One idea is to get a list of all my tags in the entire model, and try to filter them out based on the elements that I’ve selected. I’ll post more info and files as I get further or find more road blocks.

Any help whatsoever is absolutely appreciated.

One method to grab the elements that are tagged via the tag is to use Tag.TaggedElement.

I’m aware of Tag.TaggedElement. Basically I I want to do the opposite of this function.

One thought would be to get all the tags in the project and get all the elements tagged via Tag.Tagged Element. Then filter those elements through my selected elements. This seems extremely inefficient though.

If only a Element.ElementTag existed hah…

This thread might assist in writing a python script to obtain the element of an inputted tag.
http://dynamobim.org/forums/topic/get-tag-host-element/

You can build your own with dictionaries. :slight_smile:
Note: this is in 1.3.x, for 2.0.x dictionaries changed a bit.

Here is an example for getting the door tags related to a door:

The graph image:

And the graph itself:
getDoorTagsFromDoor.dyn (9.4 KB)

7 Likes

This is awesome. I’ve never used dictionaries, its kinda what I was thinking about doing but way better. In fact it could improve a ton of my programs! I’m still using 1.3.2 so this should work fine.

Maybe I’ll collect all the categories of the elements I’ve selected and create a dictionary of tags from them. Then pull the tags out with my element list.

Thanks for the help and introducing me to dictionaries!

1 Like

Glad to help out! :slightly_smiling_face: when I was introduced to dictionaries it was life changing.

1 Like

Soo the dictionary worked but I’m still not able to copy the tags. It must be because the tags need an actual view to be placed on considering they are an annotation…
This was kind of short sighted of me not to think of that. Maybe I can use the “Element.CopyFromViewToView” node from the Rhythm package somehow.

I got this far… I may try to duplicate the tags into an actual view and move them based on my distance vector.

Duplicate Elements and Tags.dyn (31.7 KB)

I’m still not at the point where I can duplicate an element and its tag together, which was the objective of this original post.

I’m starting to play with creating a new tag from the original tag but associated with the duplicated elements on my selected view. Then move it with the same vector I used to place duplicate the element. I’m actually starting to crash my video card as well every few times I run it (probably due to the dictionary lookup. It’s an AMD ATI FirePro V4800 (FireGL V) which I’ve suspected I need to upgrade for a while now.

I’ll update if I make any meaningful progress.

Feel free to comment or ask anything if you’re interested in solving this :grin:

Turn off the geometry preview for tags. Right Click>Disable Preview. In Revit 1.3.x, tags “preview” their text and it causes all sorts of madness for graphics. Or just turn off geometry preview in Dynamo all together for now.

1 Like
  • What kind of elements?
  • Copy in same view?
  • Copy how? (same place, other level, etc)
  • Can you make a small sample file? It makes it difficult for people to really know what to suggest without some context. :slight_smile:
  • for now just Light Fixtures, Electrical Fixtures, Electrical Equipment. i would assume the program could be used for most types of system elements.

  • Copy the tags into a different view

  • I copy the elements with Clockwork’s Element.CopyByVector. So really any direction. I have this part down… its getting the tags to come along with the element that is a challenge for me.

  • Ya you’re right its kinda of confusing without a sample. Any preferred version of Revit?

I would think Revit 2018 would suffice. :slight_smile:

Ask and you shall receive.

CopyElementsAndTags.rvt (904 KB)
Duplicate Elements and Tags.dyn (32.5 KB)

I’m using the junction boxes as location markers to get my vector for duplication.

Edit: Revit 2018, Dynamo 1.3.2
I updated the Dynamo file

1 Like

Finally got it. I was getting a ton of errors with the duplication node. It kept expecting a document when I was feeding it it views for some reason.

I think the method changes depending on what type of transform you feed it…

I used this method RevitAPIdocs

Here it is. The script duplicates elements and their tags without actually selecting the tags. The tags also hosts itself to the new duplicated elements. The nodes in red are things the user will need to fill out.

Duplicate Elements and Tags.dyn (30.4 KB)

1 Like

Please, first I appreciate your effort because that script is very nice, and I have question about two nodes, what should choose Capture222

For these two nodes, you need to click on an element in Revit after clicking select. This will get the location of the elements and create a vector between the origin and destination elements you selected (You can only pick one for each). When the program runs, the elements you are copying will get copied to a new location based on where they are located plus the vector we created.