How to get vertices of trees in a CityEngine model?

04-18-2016 06:53 PM
New Contributor II

I have a CityEngine model and I want to have the coordination of each of the generated trees in the median of a street. I could get the vertices of all streets (segments) in my model, as they are recognized as individual elements. (ce.getVertices(selectedStreet))

But trees are appended to blocks and cannot be selected as single objects.

Is there any way I can obtain the coordinates of the trees by any script or so?

Thank you all for your time

1 Reply
Esri Regular Contributor

If the trees are inserted into a block shape by the rule file that is applied to that block shape, then no, I don't think there is a way you can get the positions of the trees in python.

If each tree is created from its own initial shape, then yes, you can use ce.getObjectsFrom() in python to get the shapes.  Then, you could use ce.getVertices on each shape.

There are examples on the reference page for ce.getObjectsFrom() that show how to get different kinds of shapes.  Maybe using ce.isShape and ce.withName would help.

Python Scripting Interface Reference