I find this syntax odd, why is this so?

288
3
05-14-2012 10:22 AM
RobertHexter
New Contributor III
I think the reason that sometimes it is hard to adapt to the cga script is due to oddities like this that don't appear to make sense to those coming from other languages.
Why is it that this type of thing is as it is?

Does not work
case area > 1200:
                innerRect 
  alignScopeToGeometry(yUp,0,longest)

  80% :
   offset(-3)
   Building
  else: 
   Building
  
 else:
  Ground



Works
case area > 1200:
  
  80% :
   innerRect 
   alignScopeToGeometry(yUp,0,longest)
   offset(-3)
   Building
  else: 
                        innerRect 
   alignScopeToGeometry(yUp,0,longest)
   Building
  
 else:
  Ground
0 Kudos
3 Replies
MatthiasBuehler1
Frequent Contributor
it was designed to behave this way. 😮


there's advantages, there's disadvantages, but there went a lot of thought in this design.
0 Kudos
MatthiasBuehler1
Frequent Contributor
Hi ..

I've had an interesting discussion with one of the Developers and he gave me a little more insight.

so here's an additional note :


if you look in the manual under :    Manual > Rule Based Modeling > Writing Rules     ,you see that CGA distinguishes between '4 Rule Types'. Now the basic 'structure' of those rules must have correct syntax, otherwise they won't parse. depending on what you write in the rule body, different 'levels' ( term loosely translated ) are defined which each have to correspond to 1 of those 4 types.

Your specific example can actually be created by using ' push pop' which adds such a 'level' in which you have again a correct rule type.

Let me know if there's more questions ..

MyRule-->
 case geometry.area > 1200:
         innerRect 
  alignScopeToGeometry(yUp,0,longest)
  [
   80% :
    offset(-3)
    Building
   else: 
    Building
  ]
 else:
  Ground
0 Kudos
RobertHexter
New Contributor III
Interesting thanks for the additional information and follow up!
0 Kudos