Issues with imported shapes using CGA

775
4
07-21-2022 03:21 PM
PeterVieira
New Contributor II

Hello, 

I have been learning how to script in CGA (in City Engine 2019.1) in order to develop buildings from a shape file (.shp) footprint and ran into some issues.

Since the foot print is very large I first wanted to filter the footprint of smaller buildings.  to do this, I calculate the area and if a buildings area is too small, I want the shape to be deleted (script:)

const area = geometry.area

decide --> #keep or delete based off of Area
case area >= 160 : color(0,1,0)
else :
NILCGA_tests.png

 (can also see attached images) But this isn't working, the shapes get divided (green labled and kept) but the small ones aren't deleted. Does any one have a clue why? or Suggestions on alternate ways to select and delete them?

 

 

In addition I also have some shapes (roof paraphernalia/objects) that are inside of another, that for some reason were/will not union or combine when attempted.

I noticed that all of the problem shapes/faces also have a orange/red marking on some edges where a vertex connection is. I'm not sure if this means there is a double vertex there or the geometry isn't closed or what? but shapes/face without the orange marking on an edge have no trouble with processing. Does any one have any info on what may be going on? (see attached images)  CGA_tests2.pngCGA_tests3.jpg

0 Kudos
4 Replies
JonasObertuefer
Esri Contributor

Hi @PeterVieira,

CGA works best applied to rather simple shapes. So usually clean up is done before CGA and sometimes even before importing. Inside CityEngine use the "Cleanup shapes..." dialog, the various options in the "Shapes" menu for manual cleanup or you do some Python Scripting.

At the CGA stage you also have some options for further cleanups, depending on your needs:

The orange marking is just a visual indicator of the first edge of the shape. Which can be edited using shape edge tools 

Hope this helps!

Jonas

0 Kudos
PeterVieira
New Contributor II

This is all after I have used the manual clean-up; and if you look at the screenshot I posted (that has my CGA file visible on the side) I do actually use the cleanupgeometry and deleteholes commands. More specifically again, *HOW can I delete a shape or object using CGA* is the main question here. "NIL" doesn't seem to be working, so if it is "NIL" that I should use, what could cause it to simply not work?  I mean, all the shapes I'm trying to delete are simple squares/rectangles or similar  and before someone says "Do it Manually" (which DOES work) we are looking at ThousandS of these smaller shapes that I would need to select and delete. Hence why I'm trying to make a simple filter to delete the smaller shapes/objects. 

0 Kudos
JonasObertuefer
Esri Contributor

You can't delete the initial shape using CGA. CGA always needs an intial shape to work as an input, so NIL does not delete the initial shape it deletes the the current shape from the shape tree of the generated cga model. You can toggle if you want to see CGA Models or Shapes in the viewport (default you see both):

toggleDisplayOfShapesAndModelsInViewport.gif

Please have a look at CGA Essentials and Model Hierarchy for some more information about the concept in general.

0 Kudos
CherylLau
Esri Regular Contributor

Shapes can be deleted in a python script using ce.delete().

0 Kudos