Select to view content in your preferred language

assetBestSize - placing assets to fill up shapes as much as possible.

537
1
07-04-2023 08:26 AM
MattOlsen
Occasional Contributor

Hi all, 

I have some odd shapes that are produced by the split operation in one of my rules. I'm trying to fill these with an imported asset - I'd like CityEngine to pick the one that best fits the shape.

MattOlsen_0-1688483765442.png

From what I can tell, this is exactly what the assetBestSize operation should do. 

In my case - I've placed 3 assets in the project's /model folder. One is a 6x3 rectangle, another 3x6, and another a 6x6 square.

MattOlsen_1-1688484046907.png

The code I've used is as below:

SmallHouses --> alignScopeToAxes(y)
i(assetBestSize("/Hatfield/models/Test_*.obj", "xz"), zUp, keepSizeAlignPosition)
 
For some reason, the wildcard does not seem to look through all 3 assets, and instead just uses the first one in the folder (in this case, the 3x6). I've verified this by changing the file names of the assets. 
 

MattOlsen_2-1688484099126.png

Can you see anything wrong that would prevent the wildcard working - or have I misinterpreted what this operation does?

 

 

 

0 Kudos
1 Reply
ThomasFuchs
Esri Regular Contributor

Hello @MattOlsen 

Thanks for your question. Your code above looks good. I assume your OBJ files have "zUp". The CityEngine OBJ-exporter writes "yUp" files.

The "assetBestSize" search returns the asset with the best fitting size, from the files specified by searchQuery, according to the specified axisSize string. If the lots are bigger than all assets, it is likely that the biggest asset is returned in all cases. To test this, I suggest creating a shape and assigning your CGA-rule. Then, use the transform tools to adjust the size of the shape to the assets. Eventually, an other OBJ-asset will have the best size

If you want to randomize the asset insert on the lot, use assetApproxSize function—ArcGIS CityEngine Resources | Documentation

 

0 Kudos