Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is "style" function supported? #214

Open
kgs716 opened this issue May 1, 2023 · 8 comments
Open

Is "style" function supported? #214

kgs716 opened this issue May 1, 2023 · 8 comments
Assignees

Comments

@kgs716
Copy link

kgs716 commented May 1, 2023

I have CGA rule has different styles, instancing different obj files for windows

Houdini picks up only default style and gives me an error|

image

wondering "style" feature is supported in Palladio?

@mistafunk
Copy link
Collaborator

Thanks for your message. Style support is unfortunately limited - do you have a small CGA snippet which reproduces the problem?

@mistafunk mistafunk self-assigned this May 2, 2023
@kgs716
Copy link
Author

kgs716 commented May 2, 2023

of course

it's just simple pre-modeled window insertion rules

@range (min = 0, max = 50, stepsize =0.1)
attr windowHeight = 10

@range (min = 0, max = 50, stepsize =0.1)
attr LedgeHeight = 1

@range (min = 0, max = 50, stepsize =0.1)
attr Ledgewidth = 1

@range (min = 0, max = 50, stepsize =0.1)
attr bottomLedgeHeight = 0

@range (min = 0, max = 50, stepsize =0.1)
attr windowWidth = 15

@range (min = 0, max = 2, stepsize =0.001)
attr windowAlignDepth = 1

@range (min = 0.001, max = 50, stepsize =0.001)
attr windowgap = 1

@StartRule
WindowsStart -->
alignScopeToAxes(world.xyz)
comp(f){front :selfrontback | back : selfrontbackO | left : selsides | right : selsides}

//coltest -->
// color (1,0,0)

selfrontback -->
//color(1,0,0)
alignScopeToAxes(y)
split(y) {~bottomLedgeHeight : wallMatA |~windowHeight : windowSplitX |~LedgeHeight: wallMatA}*

selfrontbackO -->
alignScopeToAxes(y)
split(y) {~bottomLedgeHeight : wallMatA |~windowHeight : windowSplitX |~LedgeHeight: wallMatA}*

windowSplitX -->
alignScopeToAxes(y)
split (x) {Ledgewidth : wallMatA | {windowgap : wallMatA|windowWidth : inputWindow | windowgap : wallMatA}* | Ledgewidth : wallMatA }

selsides -->
alignScopeToAxes(y)
split(y) {~bottomLedgeHeight : wallMatA |~windowHeight : windowSplitZ |~LedgeHeight: wallMatA}*

windowSplitZ -->
// alignScopeToGeometry(zUp, any, world.lowest)
split (x) {Ledgewidth : wallMatA | {windowgap: wallMatA| windowWidth : inputWindow | windowgap: wallMatA}* | Ledgewidth : wallMatA }

window1 -->
// color(0,1,0)
alignScopeToGeometry(zUp, any, world.lowest)
i("window_hirise_1/window_cube_1.obj")
t(0,0,'-0.8)
window2 -->
alignScopeToGeometry(zUp, any, world.lowest)
i("window_hirise_1/window_cube_2.obj")
t(0,0,'-0.10)
window3 -->
alignScopeToGeometry(zUp, any, world.lowest)
i("window_hirise_1/window_cube_3.obj")
t(0,0,'-0.3)

window4 -->
alignScopeToGeometry(zUp, any, world.lowest)
i("window_hirise_1/window_cube_4.obj")
t(0,0,'-0.4)
window5 -->
alignScopeToGeometry(zUp, any, world.lowest)
i("window_hirise_1/window_cube_5.obj")
t(0,0,'-0.7)

inputWindow -->

45% : window1
3% : window2
3% : window3
3% : window4
else : window5

LedgeColor -->
color (0.7,0.7,0.2)

wallMatA -->
color (0.5,0.5,0.6)

LedgeMat -->
color (0.7,0.2,0.1)

///////////////////////////////////////////////////////////////////////////

style window_style2

WindowsStart -->
alignScopeToAxes(world.xyz)
comp(f){front :selfrontA | back : selbackA | left : selsidesA | right : selsidesA }

selfrontA -->
// alignScopeToAxes(world.xyz)
alignScopeToAxes(y)
split(y) {~bottomLedgeHeight : wallMatA |~windowHeight : windowSplitXA |~LedgeHeight: wallMatA}*

selbackA -->
alignScopeToAxes(y)
split(y) {~bottomLedgeHeight : wallMatA |~windowHeight : windowSplitXA |~LedgeHeight: wallMatA}*

windowSplitXA -->
alignScopeToAxes(y)
split (x) {Ledgewidth : wallMatA | {windowgap: wallMatA|windowWidth : inputWindowA |windowgap: wallMatA}* | Ledgewidth : wallMatA }

selsidesA -->
alignScopeToAxes(y)
split(y) {~bottomLedgeHeight : wallMatA |~windowHeight : windowSplitZA |~LedgeHeight: wallMatA}*

windowSplitZA -->
alignScopeToAxes(y)
split (x) {Ledgewidth : wallMatA | {windowgap: wallMatA|windowWidth : inputWindowA |windowgap: wallMatA}* | Ledgewidth : wallMatA }

inputWindowA -->
alignScopeToGeometry(zUp, any, world.lowest)
i("window_hirise_1/window_hirise2.obj")
t(0,0,'-1.0)

LedgeColor -->
color (1,1,1)

LedgeMat -->
color (0.7,0.2,0.1)

@mistafunk
Copy link
Collaborator

Switching to debug log level indicates that there's something wrong with the rule applied to the initial shape. Though the value of window_style2$WindowsStart is as expected...

[pld] [2023-05-04 14:03:59] [debug] get: <ishape>
	<attribute key="ruleFile" value="rpk:file:/home/shaegler/esri/dev/tickets/palladio-214-styles/cep/data/rule.rpk!/bin/rule.cgb" type="str"/>
	<attribute key="startRule" value="window_style2$WindowsStart" type="str"/>
	<attribute key="randomSeed" value="-78110994" type="int"/>
<attributable>
</attributable></ishape>
[pld] [2023-05-04 14:03:59] [info] pldGenerate1: calling generate: #initial shapes = 1, #threads = 1, initial shapes per thread = 1
[pld] [2023-05-04 14:03:59] [debug] operator(): thread 0: #is = 1
[pld] [2023-05-04 14:03:59] [debug] operator(): thread 0: #is = 1
[pld] [2023-05-04 14:03:59] [error] generate failed, exception caught: 'Unknown rule.'

Going to debug this...

@mistafunk
Copy link
Collaborator

Ok, I found a bug in Palladio when setting the style. Hope to fix this in the next release.

As a workaround, and as you are only switching between rules and not attributes, I suggest to introduce another attribute (maybe an enum) to switch between the rules.

Btw, did you create a RPK directly from the code sample you provided? Which CityEngine version did you use to create the RPK? (I noticed a problem in CityEngine when the '@StartRule` is set on a rule which is present in multiple style.)

@mistafunk mistafunk added this to the Palladio 2.0 Beta 3 milestone May 4, 2023
@kgs716
Copy link
Author

kgs716 commented May 4, 2023

Hello, thank you for the update!

yes I created a RPK directly from the code sample

I used CityEngine 2022.1

I'm new to this, so my script might be a mess

@mistafunk
Copy link
Collaborator

Interesting, I got an error regarding "multiple 'WindowsStart' start rules defined" (or similar) when creating the RPKs. I had to insert an indirection to be able to reproduce your original issue:

@StartRule
Init -->
	A // indirection needed to workaround RPK creation issue
	
A -->
	color(0,0,1)
	
style alt

A -->
	color(1,0,0)

@kgs716
Copy link
Author

kgs716 commented May 4, 2023

That might be completely my fault

sorry about the confusion!

@mistafunk
Copy link
Collaborator

No worries, this is actually a bug (or at least an unnecessary limitation) in CityEngine, I've logged an issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants