Boolean constraint

Hi Everybody,

I have made a zero-touch custom node which works fine and had a boolean output. I need to use this in a generative design to check if the design is valid or not. I know that the output node needs to be a number. So, using a simple python node, I converted the boolean to 0.0 or 1.0. When I run the generative design. It does not give an error but the the calculation does not seem to go forward at all. it shows 0/30 (zero from 30 generation) all the time and does not go forward.
What should I do?
Is there a better way to incorporate a boolean check in dynamo generative design?

That is the way to do it.

You may have added some constraints to your solution exploration which is causing most results to be thrown out preventing the generation count from being reached.

Another option (and my preference) instead of setting a constraint Is to let Generative Design try and optimize the results - that is set the output to 0 or 10, and have GD try and minimize (or maximize) that as one of the results. If you have other goals as well you can add a penalty for this boolean to those results.

That is, if all scores are normalized you sit between 0 and 10, add or subtract the boolean score from the other values giving you -10 to 20 as your new range, with the boolean outcome reinforcing the other outcomes.

1 Like

Thank you for looking into this.
I just started using GD and I do not exactly know what are the limitations when it comes to connect things to a Revit model.
My custom node gets a beam element from Revit and outputs a Boolean (pass or fail) which I have converted to 0 and 1.

Just for debugging purposes and find where the problem is. I made this graph

So, there are two separate graphs with a simple minimization of the product of two numbers.
the output of my custom node is 1 and is not changing at all. always pass. when I run the GD ignoring the “pass check” output the GD runs well and without problem. But once I add it to the constraint using (min 0.5 and max 1.5) which is always true. it gets stuck.

This might be a very basic problem that I am not aware of

Can you show the settings you are using in GD, and post your log? Also, what if any external resources are you calling in the custom node?

So with these settings

It runs like this

and with this setting,

it gets stuck like below

What do you exactly mean by log?

By the way, by the external resources, did you mean the references I have used in my code? here they are.Capture
I am using c# and my code consists of some classes for structural analysis of a concrete beam. Briefly, it gets a concrete beam, extracts material and geometry and also the hosted rebars and checks for some loading and outputs a class (defined by me) instance that one of its fields is a boolean that shows if the beam is OK or not.

by the way, my python script to get that boolean from the class and convert it 0.0/1.0 looks like this.

What is more strange, is that I can not delete the stuck studies. the recycle bin icon is greyed out.
Even restarting the computer does not help that.

Revit API cannot be called anywhere in between the Data.Remember node(s) and the Data.Gate node(s). You’re clearly doing that with this node, so it won’t run in a Generative Design context, returning Null instead.

A graph ready to run in Generative Design will return valid results in Dynamo Sandbox once Generative Design is added to the package library - check your results there to understand what’s happening. The AU Session I presented with Alexandra Nelson from PE explained what GD does pretty well - basically you get 6 concurrent instances of Dynamo Sandbox but can’t access Revit at all. You can check it out here: Generative Design at Hogwarts: Using Tech Instead of Magic | Autodesk University

As a result of the ‘null’ result, you’re never getting any results that pass the check and as such it’ll never finish.

Restarting has fixed the inability to delete for me in the past - if you can’t make that work i suggest you reach out to the development team on the Generative Design beta site, here: Welcome to Project Refinery!

1 Like

Thank you Jacob for the info. I will work in these.