Determine Street Edges of Imported Blocks

655
4
11-17-2011 09:36 AM
Jackde_Valpine
New Contributor
Hi,

I am working with blocks that were originally imported as static shapes. I have developed some script tools for subdividing the blocks based on some different things that I am trying to account for.

In short I want to figure out if there is a way to determine if the edge of a shape touches the edge of another shape. If it does not (and this can be queried somehow), then the edge must be on a street. Is there a way to do this via python or cga? Alternatively, is there a way to tag all the edges of the blocks as "street" and have that propagate to resulting subdivided shapes?

Also assuming this can be resolved and the street edge(s) identified as attributes, is it possible to orient a building/facade to the street edge?

Thanks in advance for any input!

-Jack de Valpine
Tags (3)
0 Kudos
4 Replies
Jackde_Valpine
New Contributor
Hi,

I think I discovered the answer to this on my own! It seems that if for each block shape I loop through and set on object attribute "streetWidth" for each edge (based on vertex count) then I get what I need (I think).

def setStreetWidth(name,edgecount):
    count = 0
    while (count < edgecount):
        attr = "%dstreetWidth\x00" % (count)
        ce.setAttribute(name,attr,1)
        count += 1

Thanks for taking a read,

-Jack
0 Kudos
Jackde_Valpine
New Contributor
Okay in continue my conversation with myself ;->

I realize that setAttribute should be passed a list of "streetWidth" values something like:

def setStreetWidth(name,edges):
    count = 0
    edgeList = edges*[0]
    while (count < edges):
        attr = "streetWidth"
        edgeList[count] = 1
        count += 1
    ce.setAttribute(name,attr,edgeList)

-Jack
0 Kudos
MatthiasBuehler1
Frequent Contributor II
hi !

I did not see there was a question in there the first time I glanced over the post .. sry.

this thread may help you too for other issues :
http://forums.esri.com/cityengine/forum-5617.html [last version of scripts at page 2 of the thread.]
0 Kudos
LucasSaliba_Santos
New Contributor
Okay in continue my conversation with myself ;->

I realize that setAttribute should be passed a list of "streetWidth" values something like:

def setStreetWidth(name,edges):
    count = 0
    edgeList = edges*[0]
    while (count < edges):
        attr = "streetWidth"
        edgeList[count] = 1
        count += 1
    ce.setAttribute(name,attr,edgeList)

-Jack



Hello guy,

We found your scrip very helpful , but we're having some trouble with it.

When we tried to run it, the system returns a report error at the line that contains "count = 0"

This first problem we solved by tabulating the line.

But the script is still not working. Althought it showed no more line erros, then we discovered that the tabulating could solve the script erros.

Otherwise, now the script runs, but it doesn't work, I mean after running the script the static shapes didn't get any new attibute "streetWidth".

Could you help's?

thanks in advance...
0 Kudos