POST
|
Apply this rule to all of your parking lot shapes to report each shape's area. geometry.area returns the area in the units of your coordinate system (e.g. square meters for default CityEngine scene). Lot -->
report("Area", geometry.area)
X. geometry function—ArcGIS CityEngine Resources | Documentation Then, you can see the sum of all the areas in the Reports section in the Inspector. Alternatively, you can create a dashboard card of type Key Number for the report "Area" (Window -> Dashboard).
... View more
09-15-2020
08:43 AM
|
2
|
1
|
938
|
POST
|
Yes, that is correct. The @File annotation allows you to open a file chooser. Annotations—ArcGIS CityEngine Resources | Documentation
... View more
09-15-2020
08:27 AM
|
2
|
0
|
700
|
POST
|
I tried to recreate your structure with Subdivide.cga, master_structure.cga, and master_texture.cga. I have a shape that has the Subdivide.cga rule applied to it. Then, I tried to modify master_texture.cga, (for example by changing the value of an attr in the cga file or adding a rotation to the rule), and it works for me (the model is correctly regenerated with the changes). We are aware that there are cgb refresh problems (and I've noted your issue), but without an exact repro, it will be hard to fix. If you are willing to share more insights, we'd be grateful, and you could write to me privately instead if you'd be willing to privately share some code.
... View more
09-14-2020
05:59 AM
|
0
|
0
|
211
|
POST
|
Thanks, Devin. There might be a refresh problem. Do you have more details on when and what things are not being refreshed? Do you have an example?
... View more
09-02-2020
02:20 AM
|
0
|
2
|
1033
|
POST
|
In a future release (2020.1), printing a const will work, but it doesn't work yet in 2020.0.
... View more
07-29-2020
02:03 AM
|
0
|
0
|
969
|
POST
|
No, sorry, we don't have any built-in profiling tools for cga. In your particular example, getScopeInWorld is considered a function, which is evaluated in every call. So, it is evaluated 3 times, meaning convert is evaluated 9 times. Putting a const in front of it will ensure that it is only evaluated once. CGA functions—ArcGIS CityEngine Resources | Documentation const keyword—ArcGIS CityEngine Resources | Documentation Debugging tip: You can put a print statement around the array in the getScopeInWorld definition, and you will see it is printed 3 times (plus a fourth time for the final print statement in your code above). getScopeInWorld =
print(
[convert(x, scope, world, pos, 0, 0, 0),
convert(y, scope, world, pos, 0, 0, 0),
convert(z, scope, world, pos, 0, 0, 0)]
)
print( [getScopeInWorld[0], getScopeInWorld[1], getScopeInWorld[2]] )
... View more
07-20-2020
10:48 AM
|
0
|
0
|
969
|
POST
|
Actually, there is a bug with converting from world to scope. We have to fix that. Sorry about that.
... View more
07-17-2020
02:46 AM
|
0
|
0
|
1401
|
POST
|
The reason why the ground cover doesn't work in the code above is because the Plant_Loader sets the size of the shape to zero. I would recommend making a new rule that imports the Plant_Loader instead of modifying the Plant_Loader itself. That way, if a new version of the Plant_Loader becomes available later, you can update to the new version. On the initial shape, you can call the Plant_Loader and also create the GroundCover. The same goes for the Plant_Distributor. import Plant_Loader:"/ESRI.lib/rules/Plants/Plant_Loader.cga"
Lot -->
Plant_Loader.Generate
GroundCover
GroundCover -->
color("#948477")
... View more
07-08-2020
01:23 AM
|
2
|
1
|
614
|
POST
|
Here is how the CGA material attributes correspond to the GLTF material spec based on Physically-Based Rendering (PBR). CGA material attributes material shape attributes—ArcGIS CityEngine Resources | Documentation GLTF material spec https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-material CGA material attributes GLTF material spec material.color.{r|g|b} pbrMetallicRoughness.baseColorFactor, RGB components material.opacity pbrMetallicRoughness.baseColorFactor, A component material.colormap pbrMetallicRoughness.baseColorTexture, RGB channels material.opacitymap pbrMetallicRoughness.baseColorTexture, A channel material.metallic pbrMetallicRoughness.metallicFactor material.roughness pbrMetallicRoughness.roughnessFactor material.metallicmap, B channel pbrMetallicRoughness.metallicRoughnessTexture, B channel material.roughnessmap, G channel pbrMetallicRoughness.metallicRoughnessTexture, G channel material.normalmap normalTexture material.occlusionmap, R channel occlusionTexture, R channel material.emissivemap emissiveTexture material.emissive emissiveFactor material.opacitymap.mode alphaMode material.opacitymap.cutoff alphaCutoff Demo Project The zip file attached (PBR_Demo.zip) is a CityEngine demo project that sets PBR materials in CGA.
... View more
07-07-2020
07:28 AM
|
0
|
1
|
1039
|
POST
|
Yes! Nicolai Steinø's second post is the way to do it. I forgot about trimming in my post, but Nicolai Steinø's post has it. Use the vertical trim planes created by the comp on the mass model in order to make nice corners.
... View more
07-07-2020
06:35 AM
|
0
|
0
|
1798
|
POST
|
Yes, alignScopeToAxes() will align the scope to the world coordinate system. You can then convert the scope origin to world coordinates and figure out how much you need to split out the first piece so that the rest will align to your desired grid. convert function—ArcGIS CityEngine Resources | Documentation const w=10
getScopeOriginInWorld =
[convert(x, scope, world, pos, 0, 0, 0),
convert(z, scope, world, pos, 0, 0, 0)]
getOffset(x) = case x<0: abs(x) else: w-x
Lot -->
alignScopeToAxes()
Split(getScopeOriginInWorld)
Split(point) -->
split(x, noAdjust) { getOffset(point[0]%w): SplitZ(point)
| { w: SplitZ(point) }* }
SplitZ(point) -->
split(z, noAdjust) { getOffset(point[1]%w): Cell.
| { w: Cell. }* }
... View more
07-03-2020
04:12 AM
|
0
|
1
|
1400
|
POST
|
Nicolai Steinø's post above is excellent. That is a great way to make the railing. In comparison, the code I will add is not a very nice solution, and it has limitations. However, in addition to creating a nice railing, you might also want to know how to create the corner balcony that indents inward such that you have an L shaped balcony. Here is one solution that breaks up the balcony into two pieces (which is why it is not an ideal solution). The code splits each facade into tiles. Just to test the concept, balconies are put in each corner and on a small number of random facade tiles in the middle. Then, to test if a tile should make a corner balcony, the tiles are extruded backwards to see if they intersect other extruded tiles. (Note: The code doesn't actually do an extrude here but instead uses a cube.) The screenshot shows how the corner balconies are made in two parts. The green part is created by the facade tile which comes from the last tile in the row, and the yellow part is created by the facade tile which comes from the first tile in the row. So, the last tile in the row creates a shortened balcony, and the first tile in the row creates the full width balcony. Limitations: This only works for 90 degree corners. I only considered rectangular shapes just to illustrate the principle, so this won't work for concave regions. Furthermore, this might cause some ugly, short railing pieces (since the railing is broken into two pieces) when using Nicolai Steinø's method above to create railings. Like I said, not ideal. Maybe someone has another solution. /*
This rule creates corner balconies that go inwards.
First tiles in a row create a balcony which is the full width of the tile.
Last tiles in a row create a balcony which is shortened by the balcony width.
*/
const height = 12
const floor_height = 4
const tile_width = 4
const balcony_width = 1
const balcony_height = 1
const extrudedTile_label = "Extruded_Tile"
Lot -->
extrude(height)
comp(f) { side: Facade | top: Roof. }
Facade -->
split(y) { ~floor_height: split(x) { ~tile_width: Tile(split.index) }* }*
Tile(xInd) -->
case xInd==0:
TileWithBalcony(true, false)
case xInd==split.total-1:
TileWithBalcony(false, true)
case p(0.2):
TileWithBalcony(false, false)
else:
Wall.
TileWithBalcony(isFirst, isLast) -->
s('1, '1, 0.4*tile_width)
primitiveCube
t(0, 0, '-1)
label(extrudedTile_label)
TestOcclusion(isFirst, isLast)
TestOcclusion(isFirst, isLast) -->
case overlaps(intra, extrudedTile_label):
CreateBalcony(isFirst, isLast, true)
else:
CreateBalcony(isFirst, isLast, false)
CreateBalcony(isFirst, isLast, hasCornerBalcony) -->
case isFirst && hasCornerBalcony:
color(1,1,0)
t(0, 0, scope.sz-balcony_width)
s('1, '1, balcony_width)
comp(f) { front: s('1, balcony_height, '1) BalconyRailing.
| left: s('1, balcony_height, '1) BalconyRailing.
| back: s(scope.sx-balcony_width,'1,'1) Wall.
| top: NIL
| all: Wall. }
case isLast && hasCornerBalcony:
color(0,1,0)
t(0, 0, scope.sz-balcony_width)
s(scope.sx-balcony_width, '1, balcony_width)
comp(f) { front: s('1, balcony_height, '1) BalconyRailing.
| right: NIL
| top: NIL
| all: Wall. }
else:
t(0, 0, scope.sz-balcony_width)
s('1, '1, balcony_width)
comp(f) { front: s('1, balcony_height, '1) BalconyRailing.
| top: NIL
| all: Wall. }
... View more
07-02-2020
07:37 AM
|
0
|
2
|
1798
|
POST
|
To get the position of the spheres in the world coordinate system, you don't want to use the pivot. Instead, it's easier to use convert() to convert from scope coordinates to the world coordinate system. For each sphere, you can convert the scope's origin (or the scope's center - whatever point you want) to world coordinates as follows: convert(x, scope, world, pos, 0, 0, 0) // x coord in world coords
convert(y, scope, world, pos, 0, 0, 0) // y coord in world coords
convert(z, scope, world, pos, 0, 0, 0) // z coord in world coords convert function—ArcGIS CityEngine Resources | Documentation
... View more
06-22-2020
04:54 AM
|
1
|
0
|
460
|
POST
|
The problem is that there is a mismatching number of curly braces on the previous line. Maybe get rid of the middle one. Tip: Formatting the split code so that each section is on a different line could help you figure out these kinds of mistakes. The split doesn't need to be written all on one line.
... View more
06-22-2020
03:01 AM
|
0
|
0
|
904
|
Title | Kudos | Posted |
---|---|---|
1 | 12-14-2022 07:18 AM | |
1 | 06-22-2020 04:54 AM | |
1 | 02-17-2020 03:10 AM | |
1 | 07-03-2023 03:37 AM | |
1 | 06-07-2023 05:26 AM |
Online Status |
Offline
|
Date Last Visited |
10-19-2023
12:40 PM
|