I’m trying to create filters for worksets. I found two scripts, one on here (however haven’t been able to get a response to the post due to be old) & one online, however the one online can only be applied to view templates - it does make filters though just need a node to apply to worksets or workset ID
The one on here, I am unable to run “Structural Categories” in the code block?
I am trying to create filters for structural worksets currently.
Is anyone able to shed some light or possible recommended nodes, python script or other to get back this hurdle ?
The first one is the one found on the forum
and the second is the one online that works and only needs a workset node?
@Jade, Can you post your dyn so we don’t have to rebuild the wheel so to speak? Thanks.
Create filters from worksetes poicking worksets categories.dyn (36.7 KB)
The packages mainly used are
I’ve done some changes to the script and changed the architectural catgories to structural and also done that within side the custom node.
I run it, I can select the filters for the worksets but then it won’t show. Everytime I run it though only one node in the whole thing will cack up. At first it was parameter filter by element and now it’s category by name.
I’ve also attached the basic script, the only issue is my dynamo isn’t letting me download Archilab_Grimshaw so I’m unable to run it and play around with it. Create Filters.dyn (8.6 KB)
So the datashapes stuff runs fine for me in the first run, but the script falls apart near the end, when the ParameterFilterElement.ByRules node, where you’re feeding a Filter Rule into both the name and the rules… This would be like you asking for a screwdriver and being handed a hammer… it’s useful sometimes but here it doesn’t do the trick. Adding a string “test” allowed it to run though. Think up a way to make a string to use as a name for the filter, perhaps a code block with the categories and worksets you selected as an input? Something like this (I haven’t tested though so I may be wrong):
String.Join(" ", SelectedCategorires+"")+" on Worksets " + String.Join(" ", SelectedWorksets+"");
If the datashapes stuff is giving you a headache I’ll review it, add some modifications and notations and send you that in a PM since it’s kinda a different topic (and I’d guess it’ll go for awhile if I add it here).
Also I’m seeing an issue where if you select multiple categories it won’t work, as an element can’t be on Workset 1 and be on Workset 2, and filters are set up to use AND logic, there is no OR option. One at a time will be required I think.
Excellent definitely food for thought all of it, I’ll rearrange how it’s nested through and try a different approach with your recommendation.
I just can’t workout how such a simple thing is so difficult to structure. It seems like it’d be easier to code it in python and get that to run it. E.G. Workset is “Structural”, Apply column filter to structural workset… hmm maybe it is that easy? Might just need to word it out again.
Have a look at how I structured the UI nodes on this setup.
Create filters from worksetes poicking worksets categories - Optimized.dyn (30.9 KB)
I’m gonna get some sleep, and will be celebrating Christmas with my parents and brother tomorrow, but I’ll check in on my phone periodically and will be back at my laptop in the evening. Give this a shot and see if you can make it work on a re-build.
It’s getting my head around the ParameterFilterElement.ByRule that’s the real headache! I will. Thank you for your help I hope you have a lovely time with your family tomorrow! Goodnight. (Weird saying goodnight It’s 4pm here @ 37degrees !)
Will let you know how I get on, I won’t be having much rest until I get this sorted hopefully before the start of the week ahead!
@JacobSmall Hey I’ve tried a different approach.
When I run your script the UI nodes don’t give me the option to create filters to x categories and then apply them to worksets as per screenshot.
SO I thought I’d go back a set, seeing that CreatViewFilter script already creates filters, I tried replacing the built in parameter to equal what the workset built in parameter. However it won’t create the same way still?
I’m trying to get dynamo to output this
This is what the instance_comments produces
Just having trouble re-arranging, I would have thought adding the workset parameter specified in the API it would have registered? I’m not sure how to put it together in a python script.
@JacobSmall the top string is the built in pararmeter name for the workset.
Sorry it didn’t include this one below that shows the output.