Has anyone had any luck using a mix of dynamo and python to select a single object from a Revit Link? I have been trying to either pre-select an element in a link or select it during a script process in order to find some information on an element that is in a link.
The only way of selecting a specific element from a linked file that I can think of, is by getting the linked document and knowing the id of that particular element in advance:
Thats the way I went Dimitar. I used the Get All Elements from link node from Grimshaw and then the python like you did. Its not very user friendly though. What I was hoping to do was have the user tab select an item from the link file, run the script that would grab some parameters of that object and put them in another user selected element from the active document.
Hi Jeff. Yes, I’d like to be able to do that too but unfortunately the API does not offer a lot of options. I read somewhere that it might be possible to use the Selection.PickObject() method to get a reference of the element and then from that reference extract the element from the linked document but I have not had the chance to study this in detail.
Dimitar, What about using a saved selection filter prior to the script. Use the traditional UI to tab select the link element, select the active model element. Can we get access to that saved filter inside of Dynamo or a python node?
By selection filter, do you mean a selection set? If so, Clockwork has two fine nodes that deal with those: “SelectionSet.Elements” for extracting elements stored in a set and “SelectionSet.ByElements” for creating new sets.
However I wasn’t able to add any individual linked elements to a selection set.
LOL Yea found that out the hard way. But on the plus side I created a python script that does the same thing as the two clockwork nodes. I had looked in that one but I must have just skimmed past them
On the Clockwork nodes how are they generating the list of selection sets. Is that just a string?
The node needs actual elements. You can generate a list of all the sets with the built in nodes and if you want to select a specific set from those, you can use another node from Clockwork - “Elements.FilterByName”:
As i know Dynamo not yet support single element from Link, You can use API to pick single or a few element from linked file by use method PickObjects()
I am trying to filter out spicific slab type from an IFC link that is loaded in the project. Then I want to hatch all these slab elements in the whole project. I couldn’t understand or I missed how and where does Dimitar insert the Python Script. What does it do? Is there a way that it could be done without coding? How do you feed the linked Revit file into Dynamo? Sorry kind of basic Dynamo user here. I attach an image of two different approaches I used, (the one in the red box is the latest try) but I can’t seem to be able to feed my IFC file anywhere. Please help. Thanks
I can show you how to select the IFC floor elements. However I don’t think that it’s possible to hatch them in any way. Revit does not support that functionality. If you’re interested, you might be able to make some fake hatches by programmatically drawing model curves over those floors.
I was hoping that once selected, I can override graphics in view using Revit functionality.
But anyway I still am experiencing the same ‘how to feed the link’ issue…
From my end it looks like the IFC came from an external software, and the individual elements were not assigned to categories that can be recognized by Revit. In that case I don’t think that the “Collector.LinkedInstanceElements” node will work. But manually selecting the elements with “Select Linked Elements” and then filtering them by parameter should.
The node’s use is a bit convoluted, so I recorded a quick how-to here:
Give it a try.
Hi. Thanks for your reply, but I guess I didn’t make it clear what I’m really after - I can’t possibly select all the elements that i want in this way since it’s a massive model. All I wanted was to select the link, so that Dynamo can filter them out for me
You can try a few things to check why the elements are not assigned to the correct category. First open Revit and go to R>Open>IFC Options and make sure that the IfcSlab category is mapped to the correct Revit category. Then go to the host software and make sure that the element is exported to the correct IFC category. Finally export the IFC again, remove the old link from revit and re-link the new export.
I made a node in Bakery that can get a Linked Element by GUID, but it looks like this thread has progressed from that point: