Select to view content in your preferred language

Using Point Shapes for asset placement

3528
3
05-04-2015 12:14 PM
DerekSpencer
Deactivated User

Hello,

I am still learning .cga scripting, and I've found the tutorials pretty useful for mass modeling, but I can't seem to find any references for using point data for asset placement.

I have an area in my map where no footprint data is available, but a .shp of points is available. I also have a library of around 50 residential buildings (.obj).

I would like to use this shapefile data to randomly distribute residential buildings.

Ideally, I'd like to ensure that they are rotated to face the street, but as of right now I can't seem to bring them in in the first place.

Here is what I have currently:

attr

elevation= 0

attr Residential("assets/Buildings/Residential/Residential_*.obj")

@Start

Lot -->

     i(geometry.area(rand(10,30)))=ResidentialBuilding

ResidentialBuilding -->

     alignScopeToAxes(y)

     i(assetBestSize(RESIDENTIAL))

I have tried other variations on this, including removing the lot completely (I don't need it- I just thought maybe my asset import needed an area to compare Scope with)

But no matter what I do, I seem to always get the same Mismatched Token error with my i() function.

I am sure there is a simple way to use point features for asset placement. How do I make this work?

Thank you.

0 Kudos
3 Replies
by Anonymous User
Not applicable

Here's a start:

BuildableSpace -->

     innerRect

     alignScopeToAxes(y)

     i(assetBestSize("assets/Buildings/Residential/Residential_*.obj","xz"))

See if that gets anywhere.

0 Kudos
DerekSpencer
Deactivated User

Hi Chris,

Thanks for the help. innerRect bases size on a lot shape, though. I am trying to place assets with point data because I do not have footprint or lot shapes to use for procedural generation.
Using this script I'm no longer receiving any errors, but when I Generate, nothing is placed.

0 Kudos
by Anonymous User
Not applicable

How about:

attr testAsset = "assets/Buildings/Residential.___seeBelow____.obj"

# So the testAsset should be set to a file name, not a wildcard.

# And to test this, we print to console to make sure we have a proper asset.

BuildingInsertionPoint -->

     # Scale to a point, since in CE all points are tiny squares. This inserts in model's units.

     s(0,0,0)

     print(fileExists(testAsset))

     i(testAsset)

# Let me know if this brings one of your assets into the scene.

0 Kudos