AntoineSfx Posted June 8 Share Posted June 8 (edited) I'm trying to iterate over named primitives to create a dictionary that hold, say the bounding boxes of each group of primitives. What is the correct syntax ? I always end up with a dictionary with one element and it's actually in feedback mode.. For now, I managed to reimplement it in one detail wrangle like this: string names[] = uniquevals(0,"prim","name"); s[]@names=names; foreach(string s; s[]@names) { if (strlen(s)==0) continue; // skip empty groups string gn = sprintf("@name==%s",s); int prims[] = expandprimgroup(0,gn); vector size= getbbox_size(0,gn); string ssz = sprintf("%f, %f, %f", size.x, size.y, size.z); d@infos[s]=gn; d@primCount[s]=len(prims); d@sizes[s]=ssz; } But I'm still looking for the reason why the dictionary doesn't seem to like the assignation of its keys in a feedback loop. Edited June 8 by AntoineSfx Quote Link to comment Share on other sites More sharing options...
fencer Posted June 9 Share Posted June 9 Don't see that uniquevals works to create sets, we should see a,b,c in foreach, right? names >> [ a0, a1, a2, a3, b0, b1, c0, c1, c2, c3 ] infos >> {"a0": "@name==a0", "a1": "@name==a1", "a2": "@name==a2", "a3": "@name==a3", "b0": "@name==b0", "b1": "@name==b1", "c0": "@name==c0", "c1": "@name==c1", "c2": "@name==c2", "c3": "@name==c3"} Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted June 9 Author Share Posted June 9 2 hours ago, fencer said: Don't see that uniquevals works to create sets, we should see a,b,c in foreach, right? names >> [ a0, a1, a2, a3, b0, b1, c0, c1, c2, c3 ] infos >> {"a0": "@name==a0", "a1": "@name==a1", "a2": "@name==a2", "a3": "@name==a3", "b0": "@name==b0", "b1": "@name==b1", "c0": "@name==c0", "c1": "@name==c1", "c2": "@name==c2", "c3": "@name==c3"} I don´t undertstand what you are asking. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.