AnsweredAssumed Answered

Conditional Rule File - Unexpected Token

Question asked by GWTHOMSON1 on Apr 1, 2017
Latest reply on Apr 3, 2017 by GWTHOMSON1

Hi there,

 

Still very much a learner at using CityEngine (and this forum), so I'm hoping this is a dead easy rookie mistake you guys can help with...

 

I have building layouts I've imported from ArcMap, I have worked my way up to the point of trying to create a conditional rule to apply a roof type based on the height and area of the building (which is already included within the attributes), and a colour based on whether the building is "Special" (for want of a better term) or not, which i will change myself.

 

My current rule file is as follows:

## Attributes ##

attr Height = 0
attr Area = 0

@Range("Y", "N")
attr Special = "N"

## Rules ##

@StartRule
Building -->
     extrude(Height)
     comp(f){side :  Colour | top : RoofType }
          
RoofType-->
      case Height < 12 :
           case Area < 50 : roofGable(22.5) Colour
           case Area > 50 :
                50% : roofHip(20) Colour
                25% : roofShed(10) Colour
                25% : roofShed(0) Colour
           else:
      case Height > 12 && Height < 25 :
                 50% : roofHip(20) Colour
                25% : roofGable(22.5) Colour
                25% : roofShed(0) Colour
                else:
      case Height > 25 : roofshed(0) Colour
      else: Colour

Colour-->
          case Special == "N" : color("#c7d3de")
          case Special == "Y" : color("#00338d")
          else: color("#c7d3de")

 

Long story short, its not working. My last line of code " else: color("#c7d3de") " claims there is an unexpected token, and I think this is where it is going wrong... I have tried fixing it with a terminator e.g. "End.", amongst other things, but I think I'm missing something...

 

Any help anyone can offer would be greatly appreciated.

 

Thanks!

 

Gavin

Outcomes