Select to view content in your preferred language

CityEngine - Rule File error

104
2
Tuesday
ElieRizk
Frequent Contributor

I am using CityEngine version 2024, and I am getting an unexpected token error on the following function:

Lot -->

// Apply setbacks using positional parameters (front, right, back, left)

setback(SETBACK_F, SETBACK_S, SETBACK_R, SETBACK_S)

{ remainder: Footprint | inside: NIL }


I attached the CGA file for your reference.

 

Tags (3)
0 Kudos
2 Replies
JonasObertuefer
Esri Contributor

Hi @ElieRizk ,

The setback operation syntax is different to what you have in your CGA rule. If you are looking for individual setbacks per side, see the examples at bottom in the setback cga reference.

Here is a basic snippet: 

@Range(min=1, max=25)
attr setback_front = 10
@Range(min=1, max=25)
attr setback_left = 3
@Range(min=1, max=25)
attr setback_right = 2
@Range(min=1, max=25)
attr setback_back = 5

const dists = comp(fe)
	{ front : setback_front
	| left: setback_left
	| right: setback_right
	| back: setback_back }

@StartRule
Lot --> setback(dists) { all       = Garden.   |
                         remainder : Building }
                         
Building -->
	extrude(15)

 

Hope this helps!

Best,
Jonas

0 Kudos
plfontes
Regular Contributor

Hi @ElieRizk,

Your call to the setback operation needs to follow the correct syntax: setback operation—ArcGIS CityEngine Resources | Documentation.
You are probably looking to something like this?

setback(SETBACK_F){front: NIL | remainder: 
	setback(SETBACK_R){back: NIL | remainder:
		setback(SETBACK_S){left: NIL | remainder: 
                 setback(SETBACK_S){right: NIL | remainder:Footprint}}}}

Hope that helps.

0 Kudos