import CSV and KML and Motec CSV to max

Discussion in 'Track Modding' started by Mario Morais, Oct 30, 2012.

  1. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    Importing data to 3ds max is fundamental to try to reproduce the real world in3d environment.
    I made two scripts "spline Import/Export" and "Import Geo" (old import KML).

    "spline Import/Export" can import/Export CSV files (text files)
    [​IMG]

    Detail instructions and download


    - Can import Lines Shapes in KML, CSV and GPX.
    - Import tiles Satellite images from SASPlanet. Can import tiles size of 1024x1024 to get a sharp image at max.
    - Can import entire contents of a folder

    All geographical coordinates are centered max. So all geographic contents (images and paths) are aligned correctly between them.

    [​IMG]
    [​IMG]

    This videos helps how to import images

    Go to Import GEO paga for download
     
    Last edited by a moderator: May 17, 2014
  2. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    If MAX is weird After import all splines delete the Object "TRACK_CENTER_MESH". This mesh have only one vertex and no faces and max don't like it.
     
  3. Alan Frost

    Alan Frost Registered

    Joined:
    May 7, 2012
    Messages:
    34
    Likes Received:
    0
    For me the spline exporter/importer is the BEST script so far for 3ds max. Many thanks Mario, it will save me many hours work.
     
  4. Jka

    Jka Member Staff Member

    Joined:
    Jan 31, 2011
    Messages:
    954
    Likes Received:
    213
    Yes, these are great scripts.

    Thank you, Mario.

    Cheers!
     
  5. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    New GPS format GPX!

    [​IMG]

    need tests any one have GPX files?
     
  6. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    New version of import Geo.

    Spline Geo 1.6

    1.6 changes:
    - Bug fix center object.
    - Can import all images in one folder.
     
  7. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    a Video to show my workflow.




    The background images have a dimension of 1024 because the DirectX driver of max does not allow more resolution in the viewport.
     
    Last edited by a moderator: Nov 13, 2012
  8. jtbo

    jtbo Registered

    Joined:
    Jan 12, 2012
    Messages:
    1,668
    Likes Received:
    48
    Now I'm drooling :D

    I have nmea data and that I can convert with gpsvisualizer site to gpx or csv, so this might be just what I need.

    edit: Maybe I made something foolish?
    View attachment 4687

    This error comes, when I choose geo import from menu at right, before that I chose run script and that made import geo visible to menu.

    3GB ram, 1GB free but I have then swap so total available is 7GB, but maybe it is memory problem? I try when I close browser if it works then. Code window opens to that location when error message comes.

    edit2: If I proceed ignoring that error, I got another one:
    Type error: Call needs function or class, got : false

    Then I found how to see log and there was
    -- Error occurred in createSplineFromarrays(); filename: K:\Program files\Autodesk\3ds Max 2012\Scripts\mario\import_Geo.ms; position: 21329; line: 753

    -- called in importGPXfile(); filename: K:\Program files\Autodesk\3ds Max 2012\Scripts\mario\import_Geo.ms; position: 24544; line: 869

    this at the end:
    called in importgpx_btn.pressed(); filename: K:\Program files\Autodesk\3ds Max 2012\Scripts\mario\import_Geo.ms; position: 33348; line: 1209
    -- Frame:
    >> MAXScript Rollout Handler Exception:
    -- Type error: Call needs function or class, got: false <<

    For previous If error, this is what is in that log:
    "open import_Geo"
    -- Error occurred in import_Geo.open(); filename: K:\Program files\Autodesk\3ds Max 2012\Scripts\mario\import_Geo.ms; position: 34554; line: 1266
    -- Frame:
    -- hemisphere: undefined
    -- centerobj: undefined
    -- centerX: undefined
    -- debug: undefined
    -- centerY: undefined
    -- centerZ: undefined
    >> MAXScript Rollout Handler Exception:
    -- Type error: if-test requires BooleanClass, got: undefined <<

    Another edit:

    I did test then splineINOUT script.

    I believe there is an small error at line 165, it says getSaveFileName, when I think it should be perhaps getOpenFileName.

    Reason I think so is that I got dialog box with Save button, but when I changed Save > Open then I got dialog with open button and could attempt to open the file.

    However for some reason I got another error message:
    >> MAXScript Rollout Handler Exception:
    -- Unable to convert: undefined to type: Float <<

    Maybe because of first line, must test without it:
    Ok, removing first line did cure that last error and I got spline into max, so if anyone gets that error when importing, better check that first line.

    Also despite errors in geo I did got shape into max, bit buggy shape, but shape none the less.
     
    Last edited by a moderator: Nov 14, 2012
  9. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169

    You try to import a GPX file right? GPX need more tests send me your GPX file to see.
     
  10. jtbo

    jtbo Registered

    Joined:
    Jan 12, 2012
    Messages:
    1,668
    Likes Received:
    48
    I did try with CSV, but I have no information about how to format fields for Motec standard, so I did go with GPX also, which with I had some success despite errors I got. Before importing I got one error right when I open GEO to right most area, not sure why, I have 2012 max in use, maybe that has something to do with it.

    http://jtbo.pp.fi/tiedostot/rfactor/GPS_track_Stuff/1352885195-03392.gpx

    If you want to test with really big gps files, you can dowload this file and use GPS visualizer site to convert it to gpx:
    http://jtbo.pp.fi/tiedostot/rfactor/11_nmea.zip

    That is over 1MB csv and it covers several hundred of kilometers, might be useful for testing, one can always take small part out from it to have different size of tracks to test on.
     
  11. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    The script works well in max 2010.
    At the moment i don't know what changes need to work in max 2012.


    thanks for the gpx files.


    EDIT: for 3ds MAX 2012 : try to remove the if command

    Code:
    if heapsize < 150000000 then
    (
     ....
     ..
    )
    
     
    Last edited by a moderator: Nov 14, 2012
  12. jtbo

    jtbo Registered

    Joined:
    Jan 12, 2012
    Messages:
    1,668
    Likes Received:
    48
    Thx, that got rid of the first error, when running script.

    There is still error after importing GPX, points to this:
    myspline.adaptive false --if true auto

    Says:
    Type error: Call needs function or class, got false.

    Even it complains, it works and now spline is not closed when I leave checkmark off. I get track center and track spline, so I'm not sure if error has any effect to anything really.

    Perhaps that is what causes max to crash if I start editing spline directly after importing, if I choose segment from selection (where is vertex, segment etc) max crashes immediately when clicking segment. However if I save it before editing, close max and start max again, there is no issues.
    It can also be related with max 2012 too, bit difficult to know.

    Anyway it does work, fine if I just save and close, then open again, so that is enough good for me :)
     
  13. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    You download last version???..

    EDIT: UPs!!!! is bad typo.

    i reUpload a new version.
     
  14. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
  15. jtbo

    jtbo Registered

    Joined:
    Jan 12, 2012
    Messages:
    1,668
    Likes Received:
    48
    New version works fine until importing, when I click import it thinks for a moment and then says that previous error about class and line 753 is highlighted.

    But even it says such error it imports spline fine.

    Maybe it is old woman, complains a lot but works just fine? :)
     
  16. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    the line must be "myspline.adaptive= false --if true auto"


    I was in the last days with the flu I think I'm still not good :)
     
  17. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
  18. jtbo

    jtbo Registered

    Joined:
    Jan 12, 2012
    Messages:
    1,668
    Likes Received:
    48
    No worries, I did not spot that either, even I really should have, but I have not been so good in few years :p

    I did commit edit to code and now it works without errors, good job! :D
     
  19. Mario Morais

    Mario Morais Registered

    Joined:
    Oct 26, 2010
    Messages:
    1,465
    Likes Received:
    169
    So works in max 2012 ? after removing "if heapsize.... "
     
  20. jtbo

    jtbo Registered

    Joined:
    Jan 12, 2012
    Messages:
    1,668
    Likes Received:
    48
    It seems so, haven't gotten any more errors on that area.

    However, I did manage to get new kind of errors when I did attempt to import map that I got from SAS Planet. Now it can be of course that I did something wrong too, I got just one jpg file + xml file.

    map.jpg.aux.xml and map.jpg.

    line 1138 myTexture.bitmap = myBitmap
    ---------------------------
    MAXScript Rollout Handler Exception
    ---------------------------
    -- Type error: set property requires BitMap, got: undefined
    ---------------------------
    OK
    ---------------------------

    I managed to find out how to copy easily error messages from there too :)

    Code is bit different than C# that I mostly know (very little) so I could not really see why it would give that kind of error, I did try to export as bmp too, but that did not help either, then I did download, export, stitch and copy, from SAS Planet, but that either did not change situation. Still not sure if it would be error in my export of data from SAS Planet, though.

    So I did add some of the files to zip and upload it to http://jtbo.pp.fi/tiedostot/rfactor/partaharju_maps.zip, says 5 minutes left uploading (slow internet).
     

Share This Page