Hello
I am trying to copy certain elements (instances) from one project into another. The types from the copied project will already exist and be loaded into the new one.
I have managed to copy the elements in their correct location using ElementTransformUtils.CopyElements(), but I am struggling with copying the type parameters (like, for example, the Description and the Type Mark) and the instance parameters (like the Comments or the Mark).
The idea is to process all kinds of instances, may they be system types or family symbols, and I have tried using Element.GetOrderedParameters() and LookupParameter("ParameterName") in both types and elements and setting them from the copy project to the paste project using Parameter.AsValueString() and Parameter.SetValueString() respectively.
So here goes the question:
Is it possible to copy these type and instance parameters without having to look for them by name, and in a generic manner without having to make distinctions between types and symbols?
If so, any and all tips would be appreciated.
Thanks
Solved! Go to Solution.
Hello
I am trying to copy certain elements (instances) from one project into another. The types from the copied project will already exist and be loaded into the new one.
I have managed to copy the elements in their correct location using ElementTransformUtils.CopyElements(), but I am struggling with copying the type parameters (like, for example, the Description and the Type Mark) and the instance parameters (like the Comments or the Mark).
The idea is to process all kinds of instances, may they be system types or family symbols, and I have tried using Element.GetOrderedParameters() and LookupParameter("ParameterName") in both types and elements and setting them from the copy project to the paste project using Parameter.AsValueString() and Parameter.SetValueString() respectively.
So here goes the question:
Is it possible to copy these type and instance parameters without having to look for them by name, and in a generic manner without having to make distinctions between types and symbols?
If so, any and all tips would be appreciated.
Thanks
Solved! Go to Solution.
Solved by jeremy_tammik. Go to Solution.
Solved by Sean_Page. Go to Solution.
I don't see any problem in copying the element and its instance parameter value from one document to another.
When I try to copy the element from one document to another document, I see along with the element, the element's instance parameter, and its value is also copied.
I tried to copy the element's type parameter and its value from one document to another Via UI. I have no luck.
please be aware that the Revit API hardly ever supports any functionality that is not also available in the user interface.
Therefore, if the UI does not support this, the API will probably not do so either.
So, it will always help to research the optimal manual approach to a solution first, before attacking the task programmatically.
I hope this clarifies.
I don't see any problem in copying the element and its instance parameter value from one document to another.
When I try to copy the element from one document to another document, I see along with the element, the element's instance parameter, and its value is also copied.
I tried to copy the element's type parameter and its value from one document to another Via UI. I have no luck.
please be aware that the Revit API hardly ever supports any functionality that is not also available in the user interface.
Therefore, if the UI does not support this, the API will probably not do so either.
So, it will always help to research the optimal manual approach to a solution first, before attacking the task programmatically.
I hope this clarifies.
I have several routines that I use to.copy Loadable as well as system family Types from template or linked models and all of the Parameters always come with them. Perhaps it would help to get the instance, then it's type and copy the type and then the instance?
I have several routines that I use to.copy Loadable as well as system family Types from template or linked models and all of the Parameters always come with them. Perhaps it would help to get the instance, then it's type and copy the type and then the instance?
I just came across this thread in another conversation:
I'll add the suggestion that I made there here as well:
I believe that when you collect a bunch of elements and copy them all together in one single operation, Revit will try to maintain and restore all their mutual relationships in the target database. Therefore, it might help if you add all possible references these elements have to other source database elements to the set of elements to copy. These references will include the element instances themselves, their types, phases, levels, views, materials, and whatever other objects you are interested in. Then you will have to test and see what Revit can do to try to avoid creating duplicates of them in the target database and map them to existing target objects instead.
This behaviour is hinted at in the list of extensible storage features:
https://thebuildingcoder.typepad.com/blog/2011/06/extensible-storage-features.html#7
I just came across this thread in another conversation:
I'll add the suggestion that I made there here as well:
I believe that when you collect a bunch of elements and copy them all together in one single operation, Revit will try to maintain and restore all their mutual relationships in the target database. Therefore, it might help if you add all possible references these elements have to other source database elements to the set of elements to copy. These references will include the element instances themselves, their types, phases, levels, views, materials, and whatever other objects you are interested in. Then you will have to test and see what Revit can do to try to avoid creating duplicates of them in the target database and map them to existing target objects instead.
This behaviour is hinted at in the list of extensible storage features:
https://thebuildingcoder.typepad.com/blog/2011/06/extensible-storage-features.html#7
Can't find what you're looking for? Ask the community or share your knowledge.