Grasshopper Scripts: Space Syntax 2.0

Sep, 2018

This is an idea I came up after I saw the work from spacesyntax.com. By creating a grid system, using graph theory, and counting frequencies, I found it is possible to use Grasshopper to conduct similar visibility and accessibility analysis like what space syntax.com did.  The scripts I developed here will help define circulation hierarchies and visual foci. They could also be extended to many design scenarios for streetscapes, plazas, urban parks, gardens, transit-oriented development, etc.

import itertools
import rhinoscriptsyntax as rs

#print (list(itertools.combinations(ptsGrid,2)))

def checkViews(a):
    ##tooFar/tooClose mean toofar/tooClose to look
    if rs.CurveLength(a)<tooFar and rs.CurveLength(a)>tooClose:
     ##check barrier
        for i in barriers:
            if rs.CurveCurveIntersection(a,i):
                return None
        return a
    else:
        return None

ptsAll=ptInside + ptOutside
ptsTest=ptInside[2]


def checkPts(ptsTest):
    viewLns=[]
    for i in ptsAll:
        a=rs.AddLine(ptsTest,i)
        viewLns.append(checkViews(a))##check the curve length
        viewLns=[x for x in viewLns if x is not None]
    return viewLns

a=checkPts(ptsTest)
viewExposure=[]
views=[]


for i in ptInside:
    checkPtsi=checkPts(i)
    viewExposure.append(len(checkPtsi))
    views=views+checkPtsi

viewsheds=views
result=viewExposure