Isolate by Material Finish

I’d like to isolate elements by their material. So far I’ve:

  • selected all elements
  • listed out their material finish
  • grouped all materials by same material
  • duplicate a number of views for same amount of unique materials

The next steps I am trying to achieve:

  • permanently isolate elements by the material groups in each view

This way i’ll have a series of views isolating elements based on their material, which can be exported individually to FBX (and then taken into UE4)

Any help getting to that last step will be much appreciated

Hi Andy, I think what you were missing so far is first, you were likely using List.GetItemAtIndex without eliminating elements that reported no materials (an Empty List) so were thrown a warning there - you’ll want to remove those elements from your lists so that you are properly mapping the materials and the elements to use with List.GroupByKey (group the elements with the materials as keys) see below:

Hope this helps

Thank you. That works to create a new view per material, but unfortunately I can’t get the isolate node to actually isolate elements in the view. I assumed it might not take multiple inputs and tried List.Cycle but had no luck.

I’ve also tried to use the approach shown in this thread: Export FBX by Category but again with no luck as I cannot resolve how to replace the Spring.Filter.ByCategoryName with a node to suit my requirement to filter by material property

Dynamo file attached Script-0019_Export to FBX.dyn (41.1 KB)

You’re exporting to fbx before the isolate in view is performed. Wire the output view list from that node to the fbx export and see what happens.

What outputs do you get from the Element.PermanentlyIsolateInView node? It looks as if you need to change the lacing to longest on that node

Thank you both for the help. That did the trick for isolating elements in separate views (forgot about lacing). Now all I need to do is get the FBX export to work… I’ve set lacing to longest and file directory to a location in documents.

I’ve tried using the adjusted node included in the following post with boolean toggle added, but to no avail:

Does it work with a single view? Have u tried to flatten the view list?

Unfortunately not:

It does however export the first two views if i manually select each view in a new graph and feed the export node via list.create:

Graph so far attached. Script-0019_Export to FBX.dyn (19.5 KB)

maybe someone knows how to adjust further the FBX node, because I got export problems as well - sometimes it works sometimes not [ APIDocs ]:

Export to FBX+.dyf (4.7 KB)


#Copyright (c) mostafa el ayoubi, 2016
#adjusted a bit by Thomas Vogt

import clr
from Autodesk.Revit.DB import*
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

t = Transaction(doc,'export')

def tolist(input):
	if isinstance(input,list):
		return input
		return [input]

folder = IN[0]
prefix = IN[1]
views = tolist(IN[2])
toggle = IN[3]
result = []
vset = ViewSet()

for v in views:

    result.append(doc.Export(folder,prefix + UnwrapElement(v).Name,vset,FBXExportOptions()))

OUT = 'Success'

In the end I used the “IO.ExportAsFBX” node from “WombatDynamo” package. Worked like a charm. A big thank you to those that contributed their help