# Ghpython script next steps

**URL:** <https://discourse.ladybug.tools/t/ghpython-script-next-steps/34514>\
**Category:** scripting\
**Created:** [September 11, 2024, 4:52pm UTC](https://discourse.ladybug.tools/t/ghpython-script-next-steps/34514 "2024-09-11T16:52:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gangadhar](https://discourse.ladybug.tools/letter_avatar_proxy/v4/letter/g/45deac/32.png) [@gangadhar](https://discourse.ladybug.tools/u/gangadhar)\
**Post date:** [September 11, 2024, 4:52pm UTC](https://discourse.ladybug.tools/t/ghpython-script-next-steps/34514/1 "2024-09-11T16:52:53Z")

</div>

![Screenshot 2024-09-11 170106](https://discourse.ladybug.tools/uploads/default/original/3X/3/e/3e0b6b7da91eb2c231e589a6d581e63ae3e5f832.jpeg)

# Create cylindrical supports with solid box structures on top

supports\_boxes\_and\_roadways =   
support\_spacing = length / (num\_supports + 1)  
for i in range(1, num\_supports + 1):  
support\_x = i \* support\_spacing  
support\_center = rg.Point3d(support\_x, width / 2, 0) # Center the circle under the bridge deck

```
# Create the base cylinder for the support
support_circle = rg.Circle(support_center, width / 10) # Circle with a radius relative to the bridge width
support_cylinder = rg.Cylinder(support_circle, height).ToBrep(True, True)

# Create the solid box structure on top of the support
box_base_center = rg.Point3d(support_x, width / 2, height)
box_corners = [
    rg.Point3d(box_base_center.X - box_length / 2, box_base_center.Y - box_width / 2, box_base_center.Z),
    rg.Point3d(box_base_center.X + box_length / 2, box_base_center.Y + box_width / 2, box_base_center.Z + box_height)
]
box_brep = rg.Brep.CreateFromBox(rg.BoundingBox(box_corners))

# Add both the cylinder and the box to the supports list
supports_boxes_and_roadways.append(support_cylinder)
supports_boxes_and_roadways.append(box_brep)

```

# Create a single solid rectangular structure on top of all the boxes

top\_base\_z = height + box\_height  
top\_corners = [  
rg.Point3d(0, 0, top\_base\_z),  
rg.Point3d(length, 0, top\_base\_z),  
rg.Point3d(length, width, top\_base\_z + top\_height),  
rg.Point3d(0, width, top\_base\_z + top\_height)  
]  
top\_brep = rg.Brep.CreateFromBox(rg.BoundingBox(top\_corners))

# Add the top rectangular structure to the list

supports\_boxes\_and\_roadways.append(top\_brep)

# Create the first trapezoid on one edge of the width

trapezoid\_1\_base\_z = top\_base\_z + top\_height  
trapezoid\_1\_corners = [  
rg.Point3d(0, 0, trapezoid\_1\_base\_z),  
rg.Point3d(length, 0, trapezoid\_1\_base\_z),  
rg.Point3d(length, trapezoid\_top\_width, trapezoid\_1\_base\_z + trapezoid\_height),  
rg.Point3d(0, trapezoid\_bottom\_width, trapezoid\_1\_base\_z + trapezoid\_height)  
]  
trapezoid\_1\_brep = rg.Brep.CreateFromBox(rg.BoundingBox(trapezoid\_1\_corners))

# Create the second trapezoid on the other edge of the width

trapezoid\_2\_base\_z = top\_base\_z + top\_height  
trapezoid\_2\_corners = [  
rg.Point3d(0, width - trapezoid\_bottom\_width, trapezoid\_2\_base\_z),  
rg.Point3d(length, width - trapezoid\_top\_width, trapezoid\_2\_base\_z + trapezoid\_height),  
rg.Point3d(length, width, trapezoid\_2\_base\_z + trapezoid\_height),  
rg.Point3d(0, width, trapezoid\_2\_base\_z)  
]  
trapezoid\_2\_brep = rg.Brep.CreateFromBox(rg.BoundingBox(trapezoid\_2\_corners))

# Add the trapezoids to the list

supports\_boxes\_and\_roadways.append(trapezoid\_1\_brep)  
supports\_boxes\_and\_roadways.append(trapezoid\_2\_brep)

# Create roadways along the sides of the bridge

roadway\_1\_corners = [  
rg.Point3d(0, -roadway\_width, 0), # Start at the side of the bridge  
rg.Point3d(length, -roadway\_width, 0),  
rg.Point3d(length, 0, 0),  
rg.Point3d(0, 0, 0),  
rg.Point3d(0, -roadway\_width, roadway\_height),  
rg.Point3d(length, -roadway\_width, roadway\_height),  
rg.Point3d(length, 0, roadway\_height),  
rg.Point3d(0, 0, roadway\_height)  
]  
roadway\_1\_brep = rg.Brep.CreateFromBox(rg.BoundingBox(roadway\_1\_corners))

roadway\_2\_corners = [  
rg.Point3d(0, width, 0), # Start at the other side of the bridge  
rg.Point3d(length, width, 0),  
rg.Point3d(length, width + roadway\_width, 0),  
rg.Point3d(0, width + roadway\_width, 0),  
rg.Point3d(0, width, roadway\_height),  
rg.Point3d(length, width, roadway\_height),  
rg.Point3d(length, width + roadway\_width, roadway\_height),  
rg.Point3d(0, width + roadway\_width, roadway\_height)  
]  
roadway\_2\_brep = rg.Brep.CreateFromBox(rg.BoundingBox(roadway\_2\_corners))

# Add the roadways to the list

supports\_boxes\_and\_roadways.append(roadway\_1\_brep)  
supports\_boxes\_and\_roadways.append(roadway\_2\_brep)

divider\_1\_corners = [  
rg.Point3d(0, -divider\_width, 0), # Place between the first roadway and the bridge  
rg.Point3d(length, -divider\_width, 0),  
rg.Point3d(length, 0, 0),  
rg.Point3d(0, 0, 0),  
rg.Point3d(0, -divider\_width, divider\_height),  
rg.Point3d(length, -divider\_width, divider\_height),  
rg.Point3d(length, 0, divider\_height),  
rg.Point3d(0, 0, divider\_height)  
]  
divider\_1\_brep = rg.Brep.CreateFromBox(rg.BoundingBox(divider\_1\_corners))  
supports\_boxes\_and\_roadways.append(divider\_1\_brep)

divider\_2\_corners = [  
rg.Point3d(0, width, 0), # Place between the second roadway and the bridge  
rg.Point3d(length, width, 0),  
rg.Point3d(length, width + divider\_width, 0),  
rg.Point3d(0, width + divider\_width, 0),  
rg.Point3d(0, width, divider\_height),  
rg.Point3d(length, width, divider\_height),  
rg.Point3d(length, width + divider\_width, divider\_height),  
rg.Point3d(0, width + divider\_width, divider\_height)  
]  
divider\_2\_brep = rg.Brep.CreateFromBox(rg.BoundingBox(divider\_2\_corners))  
supports\_boxes\_and\_roadways.append(divider\_2\_brep)

# Create the road between divider\_1\_brep and divider\_2\_brep

road\_corners = [  
rg.Point3d(0, 0, 0), # Start at the edge of the first divider  
rg.Point3d(length, 0, 0),  
rg.Point3d(length, pedestrian\_footpath\_width, 0), # Width of the road corresponds to the footpath width  
rg.Point3d(0, pedestrian\_footpath\_width, 0),  
rg.Point3d(0, 0, pedestrian\_footpath\_height), # Height of the road corresponds to the footpath height  
rg.Point3d(length, 0, pedestrian\_footpath\_height),  
rg.Point3d(length, pedestrian\_footpath\_width, pedestrian\_footpath\_height),  
rg.Point3d(0, pedestrian\_footpath\_width, pedestrian\_footpath\_height)  
]  
road\_brep = rg.Brep.CreateFromBox(rg.BoundingBox(road\_corners))

# Add the road to the list

supports\_boxes\_and\_roadways.append(road\_brep)

return deck, supports\_boxes\_and\_roadways
