Back

Appendix: Data file format (.bsmd file)

The app uses human-readable plain text XML files (file-extension: .bsmd) for importing/exporting model data. You can write or edit data-file directly with ordinary text editors (such as notepad) to give the app model data containing a lot of items or to alter properties of many items at once.

Ball & Stick XML elements

The app defines four kinds of XML elements to be used in data files; "Model", "Group", "Ball" and "Stick". Element names and attribute names are all case sensitive.

Example: Data file for Methane Molecule

<?xml version="1.0" encoding="utf-8"?>
<Model xmlns="http://atom.fourelem.com/ns/2016">
    <Group>
        <Ball Id="C" Position="0,0,0" Radius="0.5" Color="Black"/>
        <Ball Id="H1" Position="1,-1,-1" Radius="0.4" Color="GhostWhite"/>
        <Ball Id="H2" Position="-1,1,-1" Radius="0.4" Color="GhostWhite"/>
        <Ball Id="H3" Position="-1,-1,1" Radius="0.4" Color="GhostWhite"/>
        <Ball Id="H4" Position="1,1,1" Radius="0.4" Color="GhostWhite"/>
    </Group>
    <Group>
        <Stick Id="S1" BallIds="C,H1" Radius="0.08" Color="Silver"/>
        <Stick Id="S2" BallIds="C,H2" Radius="0.08" Color="Silver"/>
        <Stick Id="S3" BallIds="C,H3" Radius="0.08" Color="Silver"/>
        <Stick Id="S4" BallIds="C,H4" Radius="0.08" Color="Silver"/>
    </Group>
</Model>

Root element: <Model> </Model>

"Model" must be the only one root element in a data file, which contains all other elements. You can optionally define Matrix* in its attribute that is to be applied to ball coordinates.

*For details of Matrix, refer to "Sidebar: Ball Tab#About Matrix".

Example: Model element

<Model xmlns="http://atom.fourelem.com/ns/2016"
  Matrix="1, 0, 0, 0,  0, 1, 0, 0,  0, 0, 1, 0,  -0.5, -0.5, -0.5, 1">
    <!-- Put all other elements here -->
</Model>

Model element attributes:

Grouping element: <Group> </Group>

Group is an optional container element for Ball and/or Stick items. Optionally you can specify default Radius and/or Color that are to be applied to children that don't have those attributes.

Example: Group element

<Group BallColor="Gold" StickRadius="0.02">
    <!-- Put Ball and/or Stick elements here -->
</Group>

Group element attributes:

Ball item element: <Ball/>

Ball element defines a single ball item. Ball element must have Id and Position attributes.

Example: Ball elements

<Ball Id="B1" Position="0.0, 0.0, 0.0" Radius="0.25" Color="Blue"/>
<Ball Id="B2" Position="1.0, 0.0, 0.0" Radius="0.25" Color="Red"/>

Ball element attributes:

Stick item element: <Stick/>

Stick element defines a single stick item. Stick element must have Id and BallIds attributes.

Example: Stick element

<Stick Id="S1" BallId="B1,B2"  Radius="0.05" Color="Silver"/>

Stick element attributes:


Color attributes

You can specify Color either by name (such as "Red", "Blue", "Green" etc.) or hexadecimal RGB form ("#RRGGBB") as is used in HTML,CSS or SVG.

The app supports following 140 named-colors (listed in hue order)

Black
DimGray
Gray
DarkGray
Silver
LightGray
Gainsboro
WhiteSmoke
White
Magenta
Fuchsia
Snow
LavenderBlush
Violet
Plum
Thistle
Orchid
Pink
LightPink
HotPink
DeepPink
PaleVioletRed
RosyBrown
DarkMagenta
MediumVioletRed
Purple
LightCoral
IndianRed
Crimson
Brown
Firebrick
Maroon
DarkRed
Red
SaddleBrown
OrangeRed
Sienna
Tomato
Chocolate
Coral
Olive
Salmon
Peru
DarkGoldenrod
DarkOrange
DarkSalmon
LightSalmon
SandyBrown
Goldenrod
Orange
Tan
DarkKhaki
BurlyWood
Gold
PeachPuff
Wheat
NavajoWhite
Moccasin
Bisque
MistyRose
Khaki
PaleGoldenrod
BlanchedAlmond
AntiqueWhite
PapayaWhip
Linen
Beige
OldLace
SeaShell
Cornsilk
LemonChiffon
LightGoldenrodYellow
FloralWhite
Yellow
LightYellow
Ivory
GreenYellow
YellowGreen
Chartreuse
LawnGreen
OliveDrab
DarkOliveGreen
DarkGreen
Green
Lime
ForestGreen
LimeGreen
DarkSlateGray
SeaGreen
MediumSeaGreen
SpringGreen
Teal
DarkCyan
DarkSeaGreen
LightGreen
PaleGreen
MediumSpringGreen
LightSeaGreen
MediumAquamarine
MediumTurquoise
Turquoise
Aquamarine
PaleTurquoise
Honeydew
MintCream
Aqua
Cyan
LightCyan
Azure
AliceBlue
GhostWhite
Lavender
PowderBlue
LightBlue
DarkTurquoise
SkyBlue
LightSkyBlue
LightSteelBlue
DeepSkyBlue
CadetBlue
CornflowerBlue
DodgerBlue
LightSlateGray
SteelBlue
SlateGray
RoyalBlue
MidnightBlue
Navy
DarkBlue
MediumBlue
Blue
DarkSlateBlue
Indigo
SlateBlue
MediumSlateBlue
BlueViolet
MediumPurple
DarkViolet
DarkOrchid
MediumOrchid

*Based on the data-file format specifications here-in-above, you may develop or publish any softwares or services that work with Ball & Stick's models (such as importer/exporter for other programs, data-file converters, model generators, etc.).