CSV format#

The .csv (comma separated file) is used to load user provided standard models into DAVE. The CSV format is used because it is a format that can easily be edited by standard text-editors as well as spreadsheets.

The file-format is specified as follows:

  1. Based on .csv so it is easy to edit with excel and such

  2. The .csv may be comma-separated, but tab-delimited is also ok. Or mixed. Basically any , or -tab- is treated as a delimiter.

  3. Multiple delimiters count as one. So 1,,,3 is the same as 1,3 which is the same as 1 -tab- , 3

  4. Everything after a # is ignored

  5. *Something starts a “table” with a pre-defined name “Something”

  6. @Something or &Something starts a section with the name “Something”

  7. Tables and sections are technically equal, it is just the output format that is different

  8. It is not required to have the same amount of data on each line, although for tables it would make sense to use them in that way

  9. A table ends with an empty line, where comments # do not count as empty lines!

  10. A table ends when a new table starts

  11. Things outside a table are settings.

  12. Settings take the form: name, value, value2, etc and are parsed to name = (value1, value2,...) or name=value1 if only a single value is present

    • true/false (case-insensitive) are parsed to bool

    • any number is parsed to float

  13. Note: name = value is not valid. It should be name, value or name -tab- value

  14. @Something starts a “section” with a name Something TODO: Allow for the use of & instead of @ because @ is not nice in excel

  15. A section contains settings

  16. All settings in a section need to have a unique name

  17. All settings outside a section (global settings) need to have a unique name

Remarks:

  • Make sure numbers are . separated

  • Do not use , anywhere else (except in comments, there it is ok)

Warning

EXCEL by default exports incompatible .csv files if it is set to a language that uses the comma , as decimal separator.

From excel it is highly recommented to export as Text (Tab delimited)

image-20230816130147645

Example

# This is example data for an island in .csv format (comma separated values)
#
# General settings
#  key, value (s)
population, 0
location, imaginary space
best_visited_between, April, November
#
*Visuals
#
# Name , resource, off-x, off-y, off-z, rot-x, rot-y, rot-z, scale-x, scale-y, scale-z,,,
Visual1, res: island.obj,0,0,0,0,0,0,1,1,1,
#
*Buoyancy,,,,,,,,,,,,,
# Name, resource, off-x, off-y, off-z, rot-x, rot-y, rot-z, scale-x, scale-y, scale-z,invert_normals,,
Hull,res: island.obj,0,0,0,0,0,0,1,1,1,false
#
*Weights
# 'Name', 'mass [mT]', 'Cog-x', 'Cog-y', 'Cog-z', 'footprint: elevation', 'footprint: aft', 'footprint: front', 'footprint: sb', 'footprint: ps', 'inertia: rxx', 'inertia: ryy', 'inertia: rzz'
Main chunk, 230,     0       ,  0     ,  0     ,  0                    , -5              ,  5                ,   -5           , 5              , 1             , 1             , 1
Second chunk, 3,     2       ,  0     ,  0     ,  0                    , -5              ,  5                ,   -5           , 5              , 1             , 1             , 1
#
*Points
# Name, x, y, z
point1, 4, -4 , 4
point2, 8, -4 , 4
point3, 8, -8 , 4
point4, 4, -8 , 4
#
*Attachments
#
# Name,                  Target, posx, posy, posz, rotx, roty, rotz, attachments
Monkey 1,                self  ,  3  ,  3   ,  3,   , 0   , 0  , 0  , Small monkey, Big monkey
Monkey 2,                self  ,  2  , -3.5 ,  5,   , 0   ,10  , 0  , Small monkey, Big monkey
Palm tree center,        self  ,  0  ,  0   ,  2    , 0   , 0  , 0  , Palmtree
Another point,           self  ,  2  ,  0   ,  2    , 0   , 0  , 0  , Palmtree, Small monkey, Big monkey
Swing,                   self  ,  0  ,  0   ,  0    , 0   , 0  , 0  , Swing
Known errors,            self  ,  2  ,  0   ,  2    , 0   , 0  , 0  , Error_test
#
# Attachments-types
#
@ATT: Small monkey    # This is the NAME of an attachment type, @ATT: signals that this section is an attachment
class, Visual         # This is the node-class. In this case the attachment is a "Visual"
path, res: monkey.obj # These are properties of the node. All properties are supported.
scale, 0.5,0.5,0.5,   # this evaluates to node.scale = (0.5, 0.5, 0.5)
#
@ATT: Big monkey      # This is the NAME of an attachment type, @ATT: signals that this section is an attachment
class, Visual         # This is the node-class. In this case the attachment is a "Visual"
path, res: monkey.obj # These are properties of the node. All properties are supported.
scale, 1,1,4
#
#
@ATT: Palmtree        # This is the NAME of an attachement type,
class, Visual         # This is the node-class. In this case
path, res: palmtree.obj   , # These are properties of the node
expose, scale, rotation # expose these
#
@ATT: Swing
class, Suspended4PLoad   # Suspended load takes four prongs are required input
prong1, point1,          #
prong2, point2,          # these four attributes
prong3, point3,          # are mandatory
prong4, point4,          #
rigging_length, 2       # these are optional
length, 3.5
width, 4
height, 0.2
mass, 0.1
expose, mass, rigging_length, EA, length, width, height, cogx, cogy, cogz
#
@ATT: Error_test        # This is the NAME of an attachement type,
class, Visual2          # Invalid name - for testing error messages
path, res: palmtree.obj   , # These are properties of the node
expose, scale, rotation # expose these
#
# DATA tables
#
*Bananas
Banana1,sweet, 1, in the tree
Banana2,baked, 1, hidden
And, now, for something, completely, different