unfortunately, the filtering option has not been fully implemented yet
for now, a workaround would be to utilise the send / receive functions. essentially, you can add a python function that runs one either send or receive that takes the scene and each object as the argument.
if I wanted to filter out everything from the receive that isn’t a floor (my example here doesn’t have any rooms ), I could do something like the following:
import bpy
def execute(scene, obj):
print(obj.name)
if "Objects.BuiltElements.Floor" not in obj.name:
bpy.data.objects.remove(obj, do_unlink=True)
return None
else:
return obj
Cool, that’s exactly what I want to achieve. The issue I’m running into now is that the obj.name for a Room coming from Revit is the Room’s name (ex.: “A101”), and not the “Objects.BuiltElements.Room” I was hoping for.
Is the “Category” of the object available somewhere in the Speckle data in Blender?
ah, good point! that’s what I get for just using the first revit stream I could find and not going and creating a rooms example
this is a bit funny as in blender we only care about the geometry, so the objects you see are the display meshes within revit objects meaning they’re one level down and don’t have any info about the parent. I can see how this could be annoying if you’re wanting to work with revit stuff a bit more thoroughly in blender.
I think this is part of a larger issue I’ll need to think about, but for now I’ve made a quick fix of adding the parent_speckle_type as a custom property so at lest you know where the display mesh came from.
v2.2.8 of the connector is building now, so once it’s on manager and you are able to install it, you should be able to do something like this:
import bpy
FILTER = "Objects.BuiltElements.Wall"
def execute(scene, obj):
parent_type = obj.get("parent_speckle_type")
if parent_type and FILTER in parent_type:
return obj
else:
bpy.data.objects.remove(obj, do_unlink=True)
return None
That property “parent_speckle_type” appears on “normal” objects such as Duct, Fittings, etc (although for fittings, air terminals, etc it shows “Objects.BuiltElements.Revit.FamilyInstance” which is very generic, but that’s not the point of this thread…)
Here a duct is selected:
For rooms however, I do not see that property:
So the filtering works for Ducts, Walls and probably other categories but not for Rooms at this point.
Re the type being “generic” - there’s nothing I can really do about that as it’s just pulling whatever speckle_type the parent is and attaching it to the display mesh that you see in blender. If it was a family instance, then that’s the type that gets attached. We don’t have speckle models for stuff as specific as fittings and air terminals so they get converted to speckle as family instances.
Re the rooms, I’m afraid I can’t replicate this. Here is a commit I just received where I am just pulling the room volumes:
If you’re not seeing a parent_speckle_type there, then what you’re looking at isn’t the display mesh for any parent object - it’s simply a root object. It sounds like you’re trying to filter for something that isn’t actually a room. If you’re able to share more info about the objects you’re trying to pull (a direct link to the object would be fab!), then we can investigate.
hmmm something fishy is going on… I just received the commit in question and everything looks as expected. weird that the name is showing up for you as a custom prop though - it’s part of the Room model so shouldn’t be added there
I’ll have another look in the morn, but I’m guessing it must be something in your environment as I can’t reproduce the issue. perhaps a debug call is in order!
So I think the property thing was “user error” since I tried it again and it’s working. I may have been pulling a commit that was generated in Blender and not Revit and that’s why I wasn’t seeing the properties.
In any case, the filtering method works! Although a little slow since from my understanding we are removing elements from the model after downloading everything and not filtering at the server query level.