Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParameterFilter.GetRule Node #190

Open
rookiogmailcom opened this issue Mar 1, 2023 · 13 comments
Open

ParameterFilter.GetRule Node #190

rookiogmailcom opened this issue Mar 1, 2023 · 13 comments
Labels
enhancement Suggestion for an enhancement

Comments

@rookiogmailcom
Copy link

Operating system

Windows 10

Revit and Dynamo version

Revit 2023.1
DynamoRevit: 2.16.1.6510
DynamoCore: 2.16.1.2727
Orchid: 213.2.0.8342

What did you do?

Connected Parameter Filters node to ParameterFilter.GetRule node

What did you expect to see?

Expected to get list of Rules

What did you see instead?

Warning/Error per screen shot:

image

For reference the Rules have both And and Or per below screen shot:

image

Not sure if it helps you but in Revit Lookup selecting the Filter leads to a list with both an Element Parameter Filter and a Logical Or Filter:
image

It seems the logical Or filter is tripping up the "GetRule" node

@erfajo
Copy link
Owner

erfajo commented Mar 1, 2023

can i have the graph file? (add ".txt" to the extension to upload)
...and have you seen the sample collection under project?
https://github.com/erfajo/OrchidForDynamo/blob/master/Samples/Graphs/Projects/Filter.png

@erfajo erfajo added bug Bug report documentation needed Further documentation is needed labels Mar 1, 2023
@rookiogmailcom
Copy link
Author

Hi Thanks for the reply.

I had not looked at those samples and I appreciate the nudge.

However I am still having issue getting a specific set of rules.

I have included a .RVT and a .DYN to replicate the below image results.

GetRuleNodeTest_2023-03-03_11-16-35

Multiple leveled rules are causing this error in the GetRule node:

image

Unless i'm using a poor workflow, I'm trying to get all associated rules prior to removing the rules, rebuilding a ruletree and adding it back to the parameterFilter, because i cannot find a node that will simply add a rule into an existing rule tree. I can add a new rule tree but can't seem to get the rule to slot into an existign tree.

GetRuleNodeTest.dyn.txt

FilterTest.rvt.txt

Thanks very much for taking a look

@erfajo
Copy link
Owner

erfajo commented Mar 3, 2023

So apparently my code did not filter out the logical filter when it wanted to get the actual element filter... it took only a few minutes to fix that, however, I have been using this method for several years and for many other things where I filter a collection. It is widely used in the code for dynamo nodes.
image

I have now changed most of my filters knowing the distinction between the two filter methods when I use the "FilteredElementCollector".

However, I have just released a build solving other issues, and my building process runs in such a way that I can only release once a day not interrupting my "building machine" :-)
...so I can release a beta build for you, replacing it another day with a "proper" build. (5809_beta)

Thanks a lot for your feedback :-)

@erfajo erfajo removed the documentation needed Further documentation is needed label Mar 3, 2023
@rookiogmailcom
Copy link
Author

Amazing!
You're welcome, and thanks so much for your effort.

@rookiogmailcom
Copy link
Author

I have downloaded the beta build and tested it out.
Looks like it's now filtering out the Logical filter, but it's only picking up the first rule from the tree.

GetRuleNodeTest_2023-03-03_18-33-35

@erfajo erfajo added enhancement Suggestion for an enhancement and removed bug Bug report labels Mar 3, 2023
@erfajo
Copy link
Owner

erfajo commented Mar 3, 2023

aha... I have not coded it for that purpose... I will try to see what can be done :-)

@erfajo
Copy link
Owner

erfajo commented Mar 3, 2023

What do you think about this?

I have made a new node that takes the name "RuleTree" since this actually returns FilterRule(s), and renamed the old RuleTree to FilterTree since it returns filters!? the old GetRule takes only what is in first levels in the parameterfilter... maybe this is waste of time when the new node takes everything!?
image

Note: this is not released yet :-)

@erfajo
Copy link
Owner

erfajo commented Mar 3, 2023

or even better, refactor the functions so the are placed better
image

@rookiogmailcom
Copy link
Author

What do i think about that? I Love it.
Having access to both the filter tree and the rule tree I think will make it so easy to add/remove rules and recreate a filter to suit any purpose.

I assume that the rule tree output is simply a sorted list of rules - i could create myself a new rule - or delete an existing one - use any logic required rearrange the rule list to suit purpose and then use the new list to create the rule tree again?

I am currently using the below method:
AddNewRuleTest

a python node (attached sample ) to take the parameter filter, and Clear it's existing Rules which allowed me to start from scratch. This meant I had to create a temporary parameter filter then get that simple rule, add to it and reapply the new tree to the filter. Now I think having access to all the rules will make it much easier. Just get rules - add new rule, reapply.

I can't wait to try it out :-)

The only other thing i can think of that would help is a node that allows you to add a rule into an existing rule tree at any supplied index, or delete a rule from any index.... but that might be overkill. I think it can all be achieved using what we already have and what you've now created.

Love your work, thanks again!

Add New Rule Test.dyn.txt

@erfajo
Copy link
Owner

erfajo commented Mar 4, 2023

well adding and replacing should be doable today... if you see the sample I referred to earlier... in upper left side of the graph, I show how to work with the "ruletree", which will be the "filtertree" from hereon. However, deleting in a tree seems to be missed out now when i look at the sample :-)

@erfajo
Copy link
Owner

erfajo commented Mar 5, 2023

I have now worked a bit with Filters, and along the way, I started to remember why I made it as I did.

The key is the ”Tree” since you can't edit a single rule or logical thing and then push it back. You need to ”create” what is needed and then add or replace this in the tree structure, or by removing what is needed. Hereafter you can bind it to a parameterFilter.

In other words, it makes no sense to retrieve the individual thing in the tree. The tree is only needed to ”point” towards the change… either by adding, replacing, or removing.

However, I notice, that I could make it better or more ”explaining” when showing the tree structure, so I will work a bit on that. Besides that, I will create a ”replace” and ”remove” node…

From what you have send me I do think that my sample collection show you how you can use the nodes building the ”trees” you need, however, I will start with the replace/remove nodes and work on a better tree as the last thing.

@erfajo
Copy link
Owner

erfajo commented Mar 6, 2023

I have now released the new nodes and a new ruletree node.
Filter.dyn.txt
Filter

@rookiogmailcom
Copy link
Author

G'day, yeah I understand what you're saying. Thanks so much, I appreciate the updates, and the new nodes are working great for me so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Suggestion for an enhancement
Projects
None yet
Development

No branches or pull requests

2 participants