I try to place families (some model text nested in a face based generic family) onto displaced elements. I couldn’t get successfully the faces of the DisplacementElement. Now I try to get the original Element from the DisplacementElement (If you hit TAB onto the displacmentElement you can select the original family (“parent element”), to use this for placing my families and moving them to the place where the displacement elements are.
(The warnings are null values and can be neglected)
Thank you @Kulkul the method you suggested works perfectly!
/edit:
I know now why some elements are not translated: Because the placement surface of the original element and the surface of the translated elements is not the same. Thus such elements will not be created at all. So my new strategy is to place the model text at the position of the original elements and add them to the DisplacementElement Set. By doing this way, all elements get translated correctly. I have recreated most of the graph.
In the Revit file are 3 Displacement Elements. One of the Displacement Elements consits of 2 Elements (red arrow). As you can see the model text is created sucessfully at the original position of the displaced elements:
I have tried to improve the Python code. I get not warning anymore, but the elements are not added to the DisplacementElement Set
# Place your code below this line
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
# Code unterhalb dieser Linie platzieren
parDisEle = UnwrapElement(IN[0])
activeView = UnwrapElement(IN[1])
idsToDisplace = UnwrapElement(IN[2])
TransactionManager.Instance.EnsureInTransaction(doc)
for i in range( len(parDisEle) ):
diplEle = parDisEle[i]
for j in idsToDisplace[i]:
lst = []
lst.append(j)
for k in lst:
e = ElementId(k)
diplEle.GetAdditionalElementsToDisplace(doc, activeView, e)
TransactionManager.Instance.TransactionTaskDone()
# Weisen Sie Ihre Ausgabe der OUT-Variablen zu.
OUT = "None"
First it is important to create an .net icollection of the elements. And to have no conflict you need to import it with an different name. And then all you need to do is to add the elements which are already in a displacementElement Set to the list with the new elements run this python code on it:
clr.AddReference('System')
from System.Collections.Generic import List as netList
disEle = UnwrapElement(IN[0])
activeView = UnwrapElement(IN[1])
idsToDisplace = UnwrapElement(IN[2])
TransactionManager.Instance.EnsureInTransaction(doc)
for j in range( len(disEle) ):
eleIds = []
for k in idsToDisplace[j]:
eleIds.append(ElementId(k))
netEleIds = netList[ElementId](eleIds)
diplEle = disEle[j].SetDisplacedElementIds(netEleIds)
TransactionManager.Instance.TransactionTaskDone()