hello everyone,
we have a problem. we want to place objects randomly on a city we imported from open street map (osm). the thing is, we have no idea how to do this. we already have extruded our buildings and created a cylinder which should be placed on the objects (buildings). we thought we could place the cylinders on top of the buildings, which have the hight of 40 (our buildings extrude randomly between the hight of 30 to 50) any suggestions???
hereās what we have for now
import rhinoscriptsyntax as rs
import random as ran
import math
#staedteimport
#Gebaeude extrudieren, cappen und Pfade loeschen
buildings = rs.ObjectsByLayer(ābuildingsā, True)
for i in range (0,len(buildings)):
hgt = ran.uniform(30,50)
points = [(0,0,0), (0,0,hgt)]
mypath = rs.AddCurve(points,1)
rs.SelectObject(buildings[i])
obj = rs.ExtrudeCurve(buildings[i],mypath)
rs.CapPlanarHoles(obj)
rs.DeleteObject(mypath)
rs.UnselectAllObjects ()
rs.EnableRedraw(False)
#layer ausschalten bis aufā¦
if 1:
layer_names = rs.LayerNames ()
rs.CurrentLayer (āDefaultā)
for i in range (0,len(layer_names)):
if layer_names[i] != ābuildingsā:
rs.LayerVisible (layer_names [i], False)