Hi,
I’m trying to create a rule, where I can change the angle for different floors. My first issue, was actually right in the beginning, how to extrude at a building angled, with the bottom still aligned to the terrain.
Matt I saw a video with you explaining the concepts of scope (I think it was) and I think that would get me at step further. I did found the thread once again, but the video link does not work anymore. What I was trying to was to use the envelope function, but I can’t get that to create a negative angle. So if the front angle was 45 degrees , the back angle should be the same, just in a negative direction.
I’m attaching an image of what I’m trying to achieve.
By the way, I need to be rulebased, not shapemodeled, for many reasons
You might try roofShed commands after rotation of scope, or for more control of multiple anglular cuts, you might try using a vertical extrusion, and then rotation of scope to match your angles and then use split to slice off the pieces at angles. Let me know if this makes sense. I'll bet Matthias can make a demo right off his cuff.
Hi ..
this sort of building is very tricky to do in CityEngine.. but as Chris mentioned, try the roof operations or even better envelope() since it has greater control.
coding such geometries differently be tricky .. do you have more examples of what you need to reach ?
Matt
Matthias Buehler
Head of 3D Technologies
Garsdale Design Ltd.
CityEngine Services | Consulting
Is it possible to use the envelope? When I tried I could only angel it to the center of the building, and not away from the center.
I basically would like to go nuts with the angles.
Control the angles by attr like: “ different angel for each floor to the sides, but also to the back, controle the split(x) angel.
Matt where are your great video with understanding the scope, A’m I remembering wrong, or are you not creating something like that?
Thanks to your both, would defiantly try this out, as soon as I figure out to angel away from the center
Here is an example of manipulating the scope to make angled cuts:
version "2014.0"
attr storyHeight = 5
@Range(0,60)
attr angle = 30
@Hidden
attr originalScopeZ = 0
BuildingFootprint -->
set(originalScopeZ, scope.sz)
extrude(storyHeight)
rotateScope(angle,0,0)
AngledCut
splitOff = sin(angle) * storyHeight
keep = originalScopeZ * cos(angle)
AngledCut -->
split(z) {
splitOff: A |
keep: B
}
A --> NIL
B --> color(0,1,0) X.
Below is a diagram showing the calculations based on the rotated scope. This example is slicing off to make a positive angle. The same logic could be reverse to make a negative angle, but you would want to scale the footprint outwards before making a negative angle cut.
Ok, I reversed the scope splitting operation to get the negative angle you wanted to make.
CGA Code:
version "2014.0"
attr storyHeight = 5
@Range(0,60)
attr angle = 30
@Hidden
attr originalScopeZ = 0
BuildingFootprint -->
set(originalScopeZ, scope.sz)
extrude(storyHeight)
ScaleOut
addToZ = storyHeight * tan(angle)
newZ = originalScopeZ + addToZ
ScaleOut -->
s('1, '1, newZ)
t(0, 0, -addToZ)
Rotate
Rotate -->
rotateScope(-angle,0,0)
AngledCut
splitOff = sin(angle) * storyHeight
keep = cos(angle) * newZ
AngledCut -->
split(z) {
splitOff: NIL |
keep: color(1,0,0) X.
}
Wow, you have been busy. Thank you very much I appreciate this, Will have a look at you rule, and I will defiantly learn a lot by it.