Select to view content in your preferred language

Inserting trees in scenes without tree points

2143
6
08-27-2019 05:43 AM
AndrewWilliamson
Emerging Contributor

Hi I am new to CityEngine, but more importantly new to any form of coding. I would like to be able to include multiple trees in a large scene in a random but controllable way, in the absence of imported tree points. A start would be able to edit the Plant_Distributor rule to be able to choose schematic trees as in the Plant_Loader rule. I thought I might be able to figure out how to do this myself but I can't! Please can anyone help me?

0 Kudos
6 Replies
CherylLau
Esri Regular Contributor

The Plant_Distributor uses the Plant_Loader, so you can access the Plant_Loader's attributes as well.  In the Inspector, click to expand the imported rule, and set Representation = Schematic.

Luiz_AmadeuCoutinho
Frequent Contributor

Hi Andrew

You don´t need to import tree points to create trees. You can apply rules to polygons. Just drag the rule to the polygon. 

Here a printscreen of my area using greenSpace CG  rule and the result. Or here http://bit.ly/30FdkOD  

AndrewWilliamson
Emerging Contributor

Thank you - most helpful.  I'm afraid I have another question! If I assign the Plant_Distributor rule to a shape, whether static or dynamic, the only parameter in the inspector which seems to change anything is Density: Max Height does nothing.  What do I do to change the overall scale of the trees?

Thank you again.

0 Kudos
CherylLau
Esri Regular Contributor

Grayed out attributes in the Inspector means the attributes are not being used during generation.  To use MaxHeight along with the other attributes under the group Custom Mix, set Mix = Custom.

The Plant_Distributor picks species of plants and inserts them with a random height within the typical height range of the species.  With this rule, you can't scale the height of the models using the attributes in the Inspector.  The MinHeight and MaxHeight attributes set up a range of valid heights to filter which species are allowed to be inserted.  So, if you set MinHeight to 10m, then you won't get small bushes that are at most 4m tall.

If you want to scale the models, then I would suggest writing a simple rule that scatters points using scatter(), inserts random models from the Vegetation library using i(), and scales them according to an attribute.

0 Kudos
AndrewWilliamson
Emerging Contributor

Hi Cheryl

Many thanks for your replies and apologies for my ongoing stupidity, but I have started trying to develop a rule based on point scattering: It works fine if I assign it to a shape with no other rules in operation, but when I import it into another rule and try to apply it to a portion of the lot, nothing happens....if you can make out the screen grabs, please could you explain why?

Many thanks

Andrew

0 Kudos
CherylLau
Esri Regular Contributor

Rule1.Plantation doesn't exist because ScatterRule01.cga does not have a rule called Plantation.  If you hover the mouse over the compile error on this line, you will probably see that the compiler can't find a rule with this name.  You want to use Rule1.Lot instead because Lot is the name of the rule in ScatterRule01.cga that does the scattering.