download python files from here Studio Python Modules
put python files in the same folder of .gh file
import and initialize in your code
import rhinoscriptsyntax as rs import graph_1_2 as g #create graph(network) g.initFromCrv(crv) print g
actual code of get shortest path in network and visualize the path
import rhinoscriptsyntax as rs import graph_1_2 as g #create graph(network) g.initFromCrv(crv) print g #set origin node and destination node by rhino points origin = g.closestNode(pt1) destination = g.closestNode(pt2) #for visualize o and d origin_pt = origin.pos destination_pt = destination.pos #calc shortest distance from origin node to other nodes g.Dijkstra(origin) #get route edges from origin to destination rtee = g.traceRouteEdge(destination) print rtee rte = [] for e in rtee: #get curve of edge from graph edge instance rte.append(e.cv)


Comments are closed.