I'd like to use listAdd to create a string that contains geometry information about shapes generated through the comp operation. The code below separates the shape into its edge components and, in the Edges rule, tries to gather the edge lengths recursively and store them in the EdgeLengths attribute. Rather than storing separate edge lengths, it produces a string with the same edge length listed multiple times, i.e., the loop is running multiple times on the same edge shape. Is using listAdd in this way possible in CGA, or is there another way to accomplish this? Is this something I'd need Python integration for? I'm new to CGA, so any guidance is helpful! /** * File: listfunctions.cga * Created: 16 Jan 2019 20:40:45 GMT * Author: chlvws */ version "2018.0" attr EdgeLengths = "" #Rules @StartRule Lot--> comp(e) { all : Edges } Edges--> case listSize(EdgeLengths) < 3: set(EdgeLengths, AddItem(str(scope.sx))) Edges else: print(EdgeLengths) #Functions AddItem(Edge) = listAdd(EdgeLengths, Edge)
... View more