Pass forward the exact number of faces after split in z/x

06-04-2015 05:50 AM
Occasional Contributor

I need some help, I thought this would be straight forward 😉

I need to know how to pass the number of the faces after a split in the z and x direction. What my end goal should be is to create a recursion that will change the split distance until the number of faces equals a value. I want a grid of 9 faces (to make the test simple) and then I will need it to calculate the split size from that information.

So in case geometry.nFaces or == 9 : do something else : go back and modify the split value + 1 or so.  

If I try to print what is going on I can see that if I use nFaces I will get printed 1 nine times. If I use I will get 3 nine times. How can I call the actual face number sum 9? If I report on this I wil get N = 9, Sum 27, Avg = 3.

I must forget something here!


split(x) { / 3 : split(z) { / 3 : splitZ( }*}*

#split(z) { / 8 : splitZ( }*


#case Z == 1 : color(1,0,0) else : color(1,0,1)

#case == 2 : print(true) else : print(false)


report("Grid", N)

#case Z == 7 : color (1,0,0) else :  color (1,1,0)

0 Kudos
6 Replies
by Anonymous User
Not applicable


Draw a picture you should. Illuminated your intentions will become. A photo you can take of this drawing. Posted here it should become.


0 Kudos
Occasional Contributor

I’m your padawan Chris 😉

Ok, I go to my hardcore plan….


This actually the end result, but created manually. I will in this case try to place 80 points in a grid. In this rule I can manually change the split size to match 80 points. But if I would like 70, I should manually change the split size again. Not very parametric.

So I thought going the other way around, and automatically calculate the split size, from the number of points I would like.

My thought is to create a recursion that changes the split size when the number of points is not equal my selected amount, causing the points  to stand closer or further apart, and for that I guess I need to know when I’m hitting 80 points. Makes sense, or is there a more eatable solution ?

0 Kudos
by Anonymous User
Not applicable

Ok, if I make like Yoda, I should expect a padawan thrown in there.

What's the goal of the points thingy?

0 Kudos
by Anonymous User
Not applicable

Write a python script that changes the rule attributes and runs the rule over and over. Write the total points and attribute values into the reports for the model. Keep doing this until you get what you want. Keep changing the values and running until you get many attribute settings that get the right result. Make a fitness test for these and compare these against each other to get the best fit. You can make the first genetic solver for CE. Read here:

Evolutionary algorithm - Wikipedia, the free encyclopedia

0 Kudos
by Anonymous User
Not applicable

Do the results have to be in a grid as you show? Your grid is really just rows. There is a "noAdjust" parameter for the split operation if you need to split into a grid which lines up in both x and z directions. If the grid is not necessary, there might be other recursion options.

0 Kudos
Regular Contributor

Hi Kenneth

Hehe, Chris was my Padavan .. hehe.. Hope he turns to the dark side too .. 😉

There is no way in CGA to get the information of how many shapes a split will produce 'before' you actually do the split. That is a well-known limitation of CGA.

E.g. if you have a zig-zagged shape and you cut off the 'spikes', CGA cannot 'foresee' the result. You only know if once the split was actually done.



Matthias Buehler

Head of 3D Technologies

twitter: @MattB3D


Garsdale Design Limited

0 Kudos