Hello Dynamo Community!
I want to copy 2D-Elements from view to view, the views have a rotation.
It does work Perfect in Revit with Aligned to Current View or Aligned to Same Place
But i can´t get it to work with dynamo, it gives the following result:
I´m using CopyFromViewToView from Springs.
Attached is my Graph and the python code, would appreciate any advice on how i could get this to work!
Thanks in advance!
kind regards
import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
def singleton(x):
if hasattr(x,'__iter__'): return x[0]
else : return x
def tolist(x):
if hasattr(x,'__iter__'): return x
else : return [x]
source = UnwrapElement(singleton(IN[0]) )
dest = UnwrapElement(singleton(IN[1]) )
elements = UnwrapElement(tolist(IN[2]) )
tf1 = singleton(IN[3])
if tf1 is not None:
tf1 = tf1.ToTransform(True)
eId = List[ElementId](e.Id for e in elements if hasattr(e, "Id") )
TransactionManager.Instance.EnsureInTransaction(doc)
copy = ElementTransformUtils.CopyElements(source, eId, dest, tf1, None)
TransactionManager.Instance.TransactionTaskDone()
OUT = [doc.GetElement(i).ToDSType(False) for i in copy]
Hey,
I think you probably want to look at the ‘transform’ of the springs node… from memory Archilab has a node to return it ‘Transform Origin’? There are probably others… It compensates for shifts in shared coordinates, that kind of thing.
Hope that helps,
Mark
Thank you Mark, i already wondered what the “transform” input of the CopyFromViewToView node does. It is set to true…
Found the node you mentioned, i will test them!
1 Like
Hello again,
I tried to use this nodes but i don´t understand how it works and where to get the coordinate system from.
Can someone please give me more explanaition?
I want to mention that tags are not even copied because they can´t find a base element…so it would not work to rotate the copied elements after using the ViewToView node.
Are the function Aligned to Current View and Aligned to Same Place not available with the revit API
It´s so easy in Revit…
So i found some help here:
I´m now starting by getting the Location of all the 2D-Elements…and i see that it is very complex because all kinds of elements require different nodes…
I can get location of Tags, TextNotes and Dimensioning, but not for filled regions
Found another explanation:
First little succes, moving the Elements after placing them works fine by using rotation by origin
I think for tags i have to rotate the coordinates and place new family instances.
EDIT:
Placing tags does not really work how i do it ![:confused: :confused:](https://emoji.discourse-cdn.com/twitter/confused.png?v=9)
I´m still trying to figure out what this node wants as a transform input.
![image](https://global.discourse-cdn.com/business6/uploads/dynamobim/original/3X/3/c/3c030e07c8ebed5292a68867110f232f3266bcf7.png)
I found an explanation for direct shapes, is it possible that´s wehat i´m looking for?