Displace Elements (Create Displacement Set)

Is there a way to add model elements in a 3D view to a displacement set with Dynamo?

Have tried adapting python script from this thread but have had no luck:

Hello @wvee something here for cpython3…

Revit_V5bLCIWjqd
displace Home.dyn (11.5 KB)

Amazing! I noticed that it worked when selecting multiple elements, but not when selecting only a single element to displace. When only a single model element is selected it gives this error “Error: iteration over non-sequence” Is this a limitation with displacing?

you could try a list create before feed in if single, or create a node so you have option for lacing…or edit the code for both single and multiple

something here

displace Home.dyn (12.2 KB)

Great. Thankyou for your help

Hi sovitek,

I am currently trying to adapt this script to allow for multiple views, elements and vectors.

I have 10 walls, and I want to explode each one in 10 different views based on the wall orientation of each wall for the vector direction.

I am trying to do this through mapping my lists, but am having no luck. Is this something I could do through mapping the data, or would I need to understand python and adapt the script itself.

Thankyou

I think that the easiest way will be to create a custom node from the Python node, and leverage list lacing and levels to accomplish what you are after.

Hi,
Here’s some Python code:
A wall, a movement game applied to this wall, a 3D view created and centered on it.
This could be a working basis.

import sys
import clr
import System
from System.Collections.Generic import List
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")

import Autodesk 
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument
wa=UnwrapElement(IN[0])

viewType = FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements()

vt3D=[vt for vt in viewType if vt.ViewFamily==ViewFamily.ThreeDimensional][0]

def createv3dexplode(wall):
    vecn=wall.Orientation
    bb=wall.get_BoundingBox(doc.ActiveView)
    v=View3D.CreateIsometric(doc,vt3D.Id)
    v.Name="View3D_Id_" + str(wall.Id)
    bb.Transform.ScaleBasis(3/0.3048)
    v.SetSectionBox(bb)
    v.DisplayStyle=DisplayStyle.HLR
    doc.Regenerate()
    return DisplacementElement.Create(doc, List[ElementId]([wall.Id]),vecn.Multiply(2/0.3048),v,None)

TransactionManager.Instance.EnsureInTransaction(doc)
out=[createv3dexplode(w) for w in wa]
TransactionManager.Instance.TransactionTaskDone()
OUT =out

Sincerely,
Christian.stan