Isolate by Material Finish

revit

#1

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


#2

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


2 identical lists. 1 crashes. 1 doesnt
#3

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)


#4

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.


#5

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


#6

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: https://forum.dynamobim.com/t/export-to-fbx-from-data-shapes-package/18533


#7

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


#8

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)


#9

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 elayoub.mostafa@gmail.com
#Data-Shapes www.data-shapes.net
#adjusted a bit by Thomas Vogt

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

t = Transaction(doc,'export')
t.Start()

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

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


for v in views:

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

t.Commit()
OUT = 'Success'

#10

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