Dynamic or Variable Inputs

Hello All,

Just got finished with the AU course Getting Started With Generative Design In Civil 3D and am now looking to give a go for my first applied case. I had a high level question with regards to the variable inputs for a graph.

Is there any way to make an array of inputs dynamic in either number of inputs or input limits? For example:

  1. If I have a piece of geometry that has 3 PI’s, I would want 3 copies of an input set. As of my current understanding, these would need to be known ahead of time, set up, and plugged in manually. Is it possible to have an n* set of inputs based on incoming values?
  2. If my piece of geometry is x meters in length, and input one uses y amount of those meters: can we set input two’s max value to be x - y meters? Current understanding would be to set the limit for all inputs to be the same and then just limit the outcomes to the predefined length in the study.

More just curious than it being a roadblock. Thanks for any feedback :slight_smile:

There is currently no way to have a dynamic number of inputs. Depending on the exact scenario, there are ways to work around it or cover most of your conditions.

First, you need to think about what kind of input you actually need. If it’s a GD input then it will be a randomized value. If it’s a selection then does it have to be manual? Can you just get all instances of a certain object? That will help you determine what you really need to be a GD input and what can just be calculated within the graph itself.

One really useful method for controlling values dynamically is to isolate the control values from the randomization. Examples:

  • Rather than having n number of inputs in your GD graph, create a very large list of randomized values that will always cover your max number of inputs. Then just take the first n values from that list based on the condition of each run.
  • Rather than having an input define a range or limit, have the input the percentage (0-100%) of the dynamic value. Then you can have the graph calculate the dynamic value and use the randomized percentage of that value. This can also be used to calculate relative values based on other conditions (like your second example).

Hope that helps.

1 Like

It did! Took a few hours to wrap my head around it, but using both methods worked!

What I ended up doing was:

  • Went back to the whiteboard and drew a better picture to better identify the object that needed to be randomized.
  • Made an excessive array of those objects to be generated.
  • Took a total length from a list of consecutive sum lengths of the objects L1, L1+2, L1+2+3
  • Pulled only the objects that gave me a sum length less than the total length.
  • Then using your percentage/ parameter idea (and a bit of help from GPT):
  • Take the difference between the objects total length and the curves total length
  • Create an n-1 list of random numbers between 0 and 1.
  • Add 0 and 1 to the list and sort.
  • Take the difference between each consecutive number: di = ri+1 - ri
  • Multiply di by the remaining length to get and array of n random lengths that add up the the sum length.

Now the parametric model stays fixed in place at its limits but adds, removes and changes the objects within the fixed length limits.

Thanks for the help @Nick_Boyts!

1 Like

Generally best to make sure that these types of arrays aren’t overly excessive. I like to use the following formula for smaller data sets (maximum 20 items) List.OfRepeatedItems(object, Math.Ceiling(domainDimension / object.Dimension) + 2);

2 Likes