On 18/06/2015 at 18:17, xxxxxxxx wrote:
Hello everyone,
i'm trying to acomplish airplanes route animation and stuck at connecting two points with spline.
1. I parsed data from orouostai.cvs
_<_t_>_ -17.3542 | , | -145.4961 | , | AER
31.0733 | , | 33.8358 | , | KZN |
36.8222 | , | 7.8094 | , | OVB |
29.7275 | , | -85.0274 | , | CEK _ |
import c4d
import csv
import re
filepath = r'D:\Grafikos Dizainas\Projects\LRT\Plazmos grafika\JM\C4D\python\data\orouostai.csv'
scale = 10
def GetData(source) :
data = list()
with open(source, 'r') as csvdata:
dataset = csv.reader(csvdata, delimiter=',')
for row in dataset:
pattern = re.compile("[A-Z]{3}|[A-Z]{1}[0-9]{2}")
search = pattern.search(row[-1])
abbr = search.group(0)
data.append('%s, %s, %s' % (abbr, row[0], row[1]))
csvdata.close()
data.sort()
return data
def DrawData(source) :
container = c4d.BaseObject(c4d.Opolygon)
container.ResizeObject(len(source), 1)
for i in range(0, len(source)) :
row = source[i].split(',')
x = float(row[1]) * scale
y = float(row[2]) * scale
container.SetPoint(i, c4d.Vector(x, 0, y))
doc.InsertObject(container, None, None)
container.Message(c4d.MSG_UPDATE)
c4d.EventAdd()
DrawData( GetData(filepath) )
i got all points in place, but how join whem with curved spline by airport name from another cvs file marsrutai.cvs
_p> | AER | ' | KZN |
---|---|---|---|
ASF | ' | KZN | ||
ASF | ' | MRV | ||
CEK | ' | KZN | ||
CEK | ' | OVB_ |
Sincerely, D.