Hi Guys
I need an example of ElementTransformUtils.CopyElements() from one view to others
(even copying 1 element on the same view with XYZ offset does not work)
My goal is copying some custom detail items (i'm using version 2015)
thanks
Solved! Go to Solution.
Hi Guys
I need an example of ElementTransformUtils.CopyElements() from one view to others
(even copying 1 element on the same view with XYZ offset does not work)
My goal is copying some custom detail items (i'm using version 2015)
thanks
Solved! Go to Solution.
Solved by FAIR59. Go to Solution.
For the code from your previous question, the last 2 parameters can't be null.
Copy to the "same place" in the second view:
ElementTransformUtils.CopyElements(actView,selection.GetElementIds(),secondView,Transform.Identity,new CopyPasteOptions());
For the code from your previous question, the last 2 parameters can't be null.
Copy to the "same place" in the second view:
ElementTransformUtils.CopyElements(actView,selection.GetElementIds(),secondView,Transform.Identity,new CopyPasteOptions());
FAIR59 hey,
Maybe i was not so clear...i have 2 detail items simple graphics arrows one should be pointing as project north and the other should be pointing to true north
my application insert them in the current view + add a spot coordinates for the project base (0,0,0) + execute a Rotate on the second arrow
than i'm getting these 3 objects and copy + paste them [copyElements()] to other views (which are selected from a dialog box)
this does not work. the code is running but no copy is made and i get no exception at all.
so what i tried yesterday is to run it like the objects are exist by preselecting them and them invoked the command and that worked
and the 2 last args were null.
Does that means that Revit API does not like my creation objects or maybe at run time my added objects are not fully prepared to be copied?
untill my application comes to it's end.
thnaks
Moshe
FAIR59 hey,
Maybe i was not so clear...i have 2 detail items simple graphics arrows one should be pointing as project north and the other should be pointing to true north
my application insert them in the current view + add a spot coordinates for the project base (0,0,0) + execute a Rotate on the second arrow
than i'm getting these 3 objects and copy + paste them [copyElements()] to other views (which are selected from a dialog box)
this does not work. the code is running but no copy is made and i get no exception at all.
so what i tried yesterday is to run it like the objects are exist by preselecting them and them invoked the command and that worked
and the 2 last args were null.
Does that means that Revit API does not like my creation objects or maybe at run time my added objects are not fully prepared to be copied?
untill my application comes to it's end.
thnaks
Moshe
From your last description, I think the objects are indeed "not ready" to be copied.
The safest way to solve this, is to commit the creation transaction and to start a new transaction for the copying.
An alternative is to issue a Document.Regenerate(), between the creation and the copying, that might also work.
From your last description, I think the objects are indeed "not ready" to be copied.
The safest way to solve this, is to commit the creation transaction and to start a new transaction for the copying.
An alternative is to issue a Document.Regenerate(), between the creation and the copying, that might also work.
well, i am using TransactionGroup to combine all inner Transactions for one undo. from what you are saying i understand that this is my problem
but how do you explain that after inserting the second arrow i'm using ElementTransformUtils.RotateElement() to rotate it and it works?
ElementTransformUtils.CopyElements () is in the same class.
i did tried Documnet.Regenerate() before coping and it didn't work.
the other option i have is to loop through all my views of interest and insert my 3 objects at each, this will maintain one undo for the user
am i right?
thanks FAIR59
Moshe
well, i am using TransactionGroup to combine all inner Transactions for one undo. from what you are saying i understand that this is my problem
but how do you explain that after inserting the second arrow i'm using ElementTransformUtils.RotateElement() to rotate it and it works?
ElementTransformUtils.CopyElements () is in the same class.
i did tried Documnet.Regenerate() before coping and it didn't work.
the other option i have is to loop through all my views of interest and insert my 3 objects at each, this will maintain one undo for the user
am i right?
thanks FAIR59
Moshe
The need for a regeneration , or a separate transaction has come already multiple times, see http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.33
I think that the position of an element, while creating it is "fluid", so you can rotate it in the same transaction. A copy of the element requires a "fixed" position to copy from, so the creation transaction must be finished.
If you are not happy with a transactiongroup, you can indeed create several instances in different views in one transaction.
The need for a regeneration , or a separate transaction has come already multiple times, see http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.33
I think that the position of an element, while creating it is "fluid", so you can rotate it in the same transaction. A copy of the element requires a "fixed" position to copy from, so the creation transaction must be finished.
If you are not happy with a transactiongroup, you can indeed create several instances in different views in one transaction.
OK, Thank you very much
OK, Thank you very much
Can't find what you're looking for? Ask the community or share your knowledge.