Connecting polygon points.



  • 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.



  • On 19/06/2015 at 06:53, xxxxxxxx wrote:

    Hello and welcome,

    what exactly is your question? Do you want to create a SplineObject?

    Best wishes,
    Sebastian



  • On 19/06/2015 at 09:07, xxxxxxxx wrote:

    I want to join airport point with curved spline. i want to create something like this https://vimeo.com/88093956 creating spline lines, use splines as paths and move particles with tracer. But i don't know how to get values from marsrutai.csv and search it in orouostai.csv to get coordinates (longtitude latitude). for example.

    In orouostai.csv i have all my airports short names and coordinates. In marsrutai.csv i have all flight routes with airports shortnames.

    orouostai.csv ->
    (airport shortname) AAA, 54.687156, 25.279651 (coordinates)

    marsrutai.csv ->
    (origin) AAA - BBB (destination)

    Sincerely, D.



  • On 20/06/2015 at 12:15, xxxxxxxx wrote:

    If I get you correctly, you already have all airports in the scene, right?
    Now all you need is to connect them, am I correct?

    In this case, let's say, you have 2 null objects in the scene: 1 - AER and 2 - KZN airports. Both these nulls are named exactly as you have them in marsrutai.csv.

    So, logical way to do next is to parse marsrutai.csv, and get 2 airports (AER and KZN). Then do search in Object Manager to find these airports, get those coordinates, and draw a Spline Object.

    Yes, No, Yes?? I this that should work.

    Sveikas atvykes i ekspertu foruma:) (welcome to the forum)



  • On 21/06/2015 at 02:43, xxxxxxxx wrote:

    I have one polygon object with all airport points in it. Or i nees to create all 6k null objects to join them?

    Sveikas, nesitikėjau lietuvį susitikti čia :)) labai smagu!



  • On 23/06/2015 at 13:39, xxxxxxxx wrote:

    This does not have to be null objects. I just used them for example, as it's easier for me to depict what's going on in the scene.

    Does your airpots are represented as a vertex point or a polygon? In both cases, just look up for that particular vertex or polygon ID and match it to your airpot.

    P.S. We can discuss this eye to eye:) just call me. My contacts are on my page.


Log in to reply