Select to view content in your preferred language

Can anyone offer me any help with why I am getting a "Mismatch Token" error in this rule on the line indicated in bold?

1329
5
01-03-2017 12:26 PM
LindaBarrett2
Deactivated User

@Range ("Gable","Hip","Flat","Pyramid")
attr RoofType = "Gable"

@Range ("Bungalow","SplitLevel","TwoStorey","ThreeStorey")
attr myUseType = "Bungalow"

@StartRule
BronteFootprints -->
comp (f) {top:Roof |side:Wall}

Extrude -->
         extrude(myUseType)

         

* case whatUse == "Bungalow" : BungalowUseType
   case whatUse == "TwoStorey" : TwoStoreyUseType
   case whatUse == "ThreeStorey" : ThreeStoreyUseType
   case whatUse == "SplitLevel" : SplitLevelUseType
   else: Other.

BungalowUseType -->
            BungalowUse (2.75)
TwoStoreyUseType -->
T         woStoreyUse (5.5)
ThreeStoreyUseType -->
         ThreeStoreyUse (8.25)
SplitLevelUseType -->
         SplitLevelUse (4.15)

Roof-->
         case RoofType == "Gable" : GableRoof
         case RoofType == "Hip" : HipRoof
         case RoofType == "Pyramid" : PyramidRoof
         else: FlatRoof.
         color (0,1,0)

GableRoof-->
roofGable(30)
HipRoof-->
roofHip(30)
PyramidRoof-->
roofPyramid(30)
Wall-->
color (46,46,46)

0 Kudos
5 Replies
ThomasFuchs
Esri Regular Contributor

Hello Linda,

Thank you for your question. The CGA language is structured by concatenating rules. Separating parts of a rule that are common from conditional ones helps in analyzing the shape tree. So if you are using a case statement, it has to be encapsulated in a conditional rule.

Everything preceding the conditions needs to be put into a separate rule. It is possible to generate different successors for different conditions of rule parameters or shape attributes. The case and the else statements must build a consecutive block and can not be interrupted with successors (like a switch-case block, NOT like if statements in well-known programming languages).

PredecessorShape --> 
                     case condition1: Successor1 


                     case condition2: Successor2
                     ...
                     else: SuccessorN 
0 Kudos
DuliniRatnayake
Occasional Contributor

Hi Linda,

You need a conditional statement as Thomas mentioned but I would use attribute data to extrude buildings foot prints, which is less complex.I am also working on a similar rule.

Call me if you need any help.

Dulini

0 Kudos
LindaBarrett2
Deactivated User

Hi Dulini,

I may do that.  Thanks for your help

0 Kudos
LR
by
Frequent Contributor

You're trying to extrude using text as parameter. You're also never calling the Extrude rule. Case rules also can't have any commands but cases. Try this instead:

@Range ("Bungalow","SplitLevel","TwoStorey","ThreeStorey")
attr myUseType = "Bungalow"

@Hidden
attr myUseTypeHeight = 0

@StartRule 
Lot -->
 SetHeight
 
SetHeight -->
 case myUseType == "Bungalow": set(myUseTypeHeight, 2.75) Extrude
 case myUseType == "SplitLevel": set(myUseTypeHeight, 4.15) Extrude
 case myUseType == "TwoStorey": set(myUseTypeHeight, 5.5) Extrude
 case myUseType == "ThreeStorey": set(myUseTypeHeight, 8.25) Extrude
 else: set(myUseTypeHeight, 1) Extrude

Extrude -->
 extrude(myUseTypeHeight)
 comp (f) {top:Roof |side:Wall}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
LindaBarrett2
Deactivated User

Thank you - this is exactly what I was looking for.