Select to view content in your preferred language

How to create a bridge connecting two houses over a street?

86750
8
Jump to solution
08-20-2017 10:53 AM
CarlaBernecoli
Occasional Contributor

Hi all.

I am trying to create a connecting bridge between two houses located on opposite sides of a street or water channel. Something like Venice's Ponte dei Sospiri.

https://previews.123rf.com/images/efired/efired1511/efired151100008/48883498-Veduta-del-Ponte-dei-So... 

Does anybody know how to write a CGA that does this?

Many thanks!

0 Kudos
1 Solution

Accepted Solutions
CherylLau
Esri Regular Contributor

Maybe you could use the occlusion queries (inside, overlaps, touches) with labels to check if the bridge intersects a specific building (with a specific label) on the other side.  What might work is a recursive function that keeps translating (or repositioning) the bridge until the intersection test passes.  You might want to keep track of the building position/scope on the first side or test for intersection on the first side as well.  For example, you could create two faces, one for each side of the bridge and test if they are inside the buildings.  Then, once you find a good position, you could recreate the bridge again from the two faces on the bridge's ends.  Don't forget to make sure the recursion will always stop at some point.

View solution in original post

8 Replies
LR
by
Frequent Contributor

Make a bridge rule for one of the buildings and move it into place. Here's a simple example:

Lot -->
 Building
 Bridge
 
Building -->
 primitiveCube(50, 50, 50)
Bridge --> 
 primitiveCube(10, 10, 20)
 t(0,10,35)
0 Kudos
CarlaBernecoli
Occasional Contributor

Hi! Thank you so much for the help

This would create a bridge, but I guess it wouldn't make sure that it hits a house on the other side of the street for instance. It could end in the space between two lots. Is there a way to make sure the two lots are connected?

Also it might not take in account the shape of the house (L shape for instance) or the width of the street in between. 

Is there any way to keep these factors in account?

Thanks!

0 Kudos
CherylLau
Esri Regular Contributor

Maybe you could use the occlusion queries (inside, overlaps, touches) with labels to check if the bridge intersects a specific building (with a specific label) on the other side.  What might work is a recursive function that keeps translating (or repositioning) the bridge until the intersection test passes.  You might want to keep track of the building position/scope on the first side or test for intersection on the first side as well.  For example, you could create two faces, one for each side of the bridge and test if they are inside the buildings.  Then, once you find a good position, you could recreate the bridge again from the two faces on the bridge's ends.  Don't forget to make sure the recursion will always stop at some point.

CarlaBernecoli
Occasional Contributor

Fantastic! I must try this. It def could work. 

A couple questions: 

I guess the bridge should be as long as the street width parameter right?

"For example, you could create two faces, one for each side of the bridge and test if they are inside the buildings"

Should the face on the other side have the normals flipped? 

How would you recreate the bridge again from these two faces?

0 Kudos
CherylLau
Esri Regular Contributor

I was thinking to use comp with the = operator to get the end faces in a single shape.  You could do this by assigning NIL to all the other sides, and then using all= to get the end faces.  And, you don't have to worry about normals.  Then, you can use inside() to test if both of the faces are inside a building.  Then, you can "recreate" the bridge by inserting a primitive cube into the scope, which replaces the two end faces with a cube.

Of course, there are multiple ways which you could create the bridge, and I imagine, maybe, you found another way.

0 Kudos
CarlaBernecoli
Occasional Contributor

Hi Cheryl

It worked very well, the bridges are connecting!

Right now I have set up a standard max lenght for a bridge before the operation gets canceled. Is it possible for a CGA rule applied to a lot to gather the width of the street in front of it? 

I am referring to the StreetWidth Object Attribute. Is there a way to get it "into" the cga rule so I can use it to set up the exact lenght of the bridges?

Many thanks again

CarlaBernecoli
Occasional Contributor

Because otherwise the risk is that the bridge becomes too long and passes trough a building it does not "find" with the occlusion test, to get to the next usable one. 

CherylLau
Esri Regular Contributor

Yes, you can get the street width values by creating a rule attribute that takes a parameter like this:

attr streetWidth(i) = 0‍‍

Then, you can access the values by giving the index as the parameter like this:

print(streetWidth(0))     // print first street width in list
0 Kudos