Copy element to clipboard and paste to same place

Hello all,

I guess we are all familiar with the copy to clipboard command in Revit. Is there some way I can replicate that in Dynamo? Essentially what I am looking to achieve is copy hosted elements (e.g. a door) to the clipboard, delete the host wall, and paste it on a newly created wall in its place.

I have tried the Copy Elements To Same Place node from Bakery and Copy from Document Node from Rhythm by giving input as current document but they do nnot work as the elements get deleted as soon as the host gets deleted. So if by some way I can copy to clipboard instead, I’ll be able to paste them later, even after the host is no longer there.

Any ideas?

Can you just draw the wall in place, then delete the old one. The doors should automatically rehost. Or even set the type of the wall?

No, they do not automatically rehost. Once the old one is deleted, the doors get deleted too, even if the new wall is exactly in the same place.

I would try to change the type of the wall. Doesn’t seem possible to change the host of a family unfortunately. :thinking:

I don’t want to change the type! The type should be the same. I can understand that changing the host is not possible, that is why I asked if we could somehow copy to clipboard? Doing that is possible within Revit and it does change the host that way. Looking to do the same in Dynamo.

Well, you being rude and short doesn’t help make a solution happen too easy.

I suggest reading the community guidelines.
https://forum.dynamobim.com/faq

###Good luck with your task, I’m going to sit this one out.

-John

4 Likes

Apologies if that sounded rude, it wasn’t meant to be. I’ve read the guidelines. :slight_smile:

To explain it further,

I have the following elements hosted on a wall. Now I am splitting that wall into 2 different walls. I want the doors to still remain after the original wall has been deleted.

Before:

After:

1 Like

Use the split command in revit natively?

The splitting has to be done for quite a few elements (in 1000s) at specific points. I have achieved the wall splitting using a Dynamo script but am stuck at this problem of elements losing their host.

Post how you made the elements split. May be a better way to achieve what you did which won’t require re-creating quite so much.

The process I used can be inferred from the discussion here:

Essentially I have used some nodes from DominaDynamo, as was suggested in the solution for this topic. I wasn’t sure if I should reply on the same thread as the topic was different and solved, hence I created a new thread.

Could you get your existing walls’ path, split the curves as necessary, then create new walls based on those curves and delete the original walls? It seems like creating new walls based off the existing geometry would be easier than manipulating existing walls themselves.__

Correct. And that is exactly what has been done in the thread I referenced in my previous post. The next challenge now is to retain the hosted elements.

I gotcha. Sorry, I thought you were still stuck on the first part.

Have you considered placing new doors/windows?

Yes. The only issue that I am facing is that the doors get deleted as soon as the script runs so I am unable to retain any information about them and all the nodes return null values. That is why I wanted to know if a way exists which can retain the information about the elements - maybe on a clipboard - so that it can be run after the original elements have been deleted.

I have used Transaction.Start and Object.Identity nodes to delay part of the script as I found them on other places on the forum but I don’t think they will be useful for this task. They were useful for placing the new walls after deleting the old ones though.

I would try creating all your new stuff first, then delete the old stuff.

If the new stuff is created first then it hosts on the original wall and not the new wall, so when the original wall gets deleted, even the new stuff gets deleted.

Are you using the Springs HostedInstance.ByPoints node? It takes a host element so you should be able to specify which wall. However, I can still see it potentially having issues if another element matches the surface exactly.

I have a sneaking suspicion that the Clipboard is asking for trouble. Yes you can send things to the clipboard and paste them automatically, but doing so with that large of a data set is going to be problematic.

This is a crazy thought but…

  1. Save the project as prior to running the script.
  2. Set things up to read/map hosts so that you’re getting the same elements in the new file and the old.
  3. Get everything hosted in the referenced model.
  4. Create a new instance on the new host for every hosted element.
  5. Set parameter values for the new elements based on the values in the old model.

Still a tall task either way.

Yes, I agree this may be a solution but saving as is a manual step I guess.

I have a thought that Excel could be used as a data dump or “Clipboard” and that information can then be read back in Dynamo from excel even after the elements are deleted. Still looking for a better solution though as this will involve running 2 scripts.