Python : read worksets from linked file

hello all,
i want to write a python script to read worksets from linked files
i found the following script which reads worksets from the existing file but not from the linked ones.
how can i adjust it so that it read from the linked files also?

p.s i found ways to do it on dynamo ,nevertheless i am doing this as an excercise for python

You need to feed the Link instances or get them with another collector, then use GetDocument() method for replacing the doc in the FilteredElememtCollector for worksets.

ws = FilteredElememtCollector(linkDoc).OfKind(...)

2 Likes

thanks sean for your advice , i tried following your steps as the picture , but i get an error Filteredworkset not defined . iam totally beginner in dynamo and python execuse me

Check the capitalization on linkDoc in your collector. Python is car sensitive like most programming langues.

1 Like

thanks a lot sean ,it turned all the problem was in capitalization as you said and also in the imported library , the code now works .the script on the right works while the on the left does not work, the only difference between them is the imported library at the beginning of the code

1 Like

Yes, the single quote can be a little weird sometimes especially if your copying and pasting. Glad you got it worked out.

2 Likes