Hi,
I'm wondering if there is a way to store a parent shape to refer back to in CGA. I used the shapeO operation to randomly generate O-shaped area. And then I ran a comparison to see if the area is greater than a certain threshold. If not, I want to regenerate the O-shaped area again until it meets the criteria. My current cga creates a recursion. But I was wondering if I can get a hold of the parent shape the OShape was generated from.
OShape -->
shapeO(rand(0, 5), rand(0,50), rand(0, 20), rand(0,20)){shape:X|remainder: Calc}
Calc -->
case geometry.area > 60:
extrude(10)
else:
OShape
Any pointers are appreciated!
Lesi
You could store attributes in variables, like this: set(initialArea, geometry.area)
Thank you for the reply! I may not have been clear when I posted the question. But I'm wondering if there is a way to store the actual shape but not just the attributes.
I don't think you can. What are you trying to do?
You can more or less store a shape with Python (getVertices and getAttribute), if that helps.
I was trying to generate a shape with random dimensions on a lot. But if the area of the new shape is under a certain threshold, I want to regenerate the shape until it meets the criteria.
To my knowledge this won't be possible with CGA alone. CGA only goes in one direction, and you'd have to return to a previous state. You can call a previous rule, but it'll be applied to the current state.
You have to re-run the rule until the area condition is met. Remove the recursion and run the script until the object is generated. Don't forget to update the seed, or you'll always get the same "random" numbers.
You can either do it manually (ugh) or automatically with Python (using reporting to export a variable to check in a loop).