For a full explanation of how to add an object type to the Dna, please see the explanation of the Object Type element in _SRC XML. This page will instead describe the typical process for adding a new object type to an existing Dna.
Find a similar object type in the Dna and copy the whole Object Type element.
What counts as similar will of course depend on the current state of the Dna and which object type you are adding. Sometimes you are adding a new kind of marker board to a Dna that already contains other marker boards. In that case, copying one of the other marker board types is a good start. In other cases there is no obvious candidate for the most similar object type. Even then it is often easier to copy another object type than starting from scratch. Pay attention to the Class and Datatype attributes. The Object Type element is everything from the opening “<ObjectType>” tag up to and including the closing “</ObjectType>” tag.
The Name attribute is the identifying attribute of the object type and must be unique in the Dna. So it’s best to change it right away. The LuaName attribute defines an alias for the object type name that can be used in Lua code. This also has to be unique and so should be changed right away.
<ObjectType DataType="tSignal" Class="RailwayPlacedObject" LuaName="rctype_SignErtmsElectrificationBoard" Name="JBTEH_BKT ERTMS Electrification board"
Layer="JBTEH_BKT" Color="ByLayer"
Group="Skilt/Kjørende personell/ERTMS Electrification board"
AttMirrorY="{% if RightSided %}true{% else %}false{% endif %}"
>
That’s it! We have created a new object type. But the new object type currently has the same variants, properties, 2D symbol and 3D geometry as the one we copied. We probably don’t want that, so let’s start changing the object type!
Object types can be quite large, so it may make sense to clean out things you know you don’t need for your new object type before continuing. Look for CustomProperty elements you don’t need (along with Lua formulas used for them). If the object type you copied had many more variants than you need deleting most of the InsertPointObject elements will make things a bit more manageable.
Relations are defined through relation spaces. The object type’s relation space is defined by the “RelationSpace” element. Either choose a space with existing relations defined (usually in a different file) or create a new relation space. If you need a new relation space you should define relations for the new space, this is done outside of the “ObjectType” element, usually in a different file.
You may need to update the “AttachmentCategory” and “AttachTo” elements. These define which object types your new object type can attach to and which object types can be attached to your new object type.
<RelationSpace>skilt</RelationSpace>
<AttachmentCategory Name="skilt" PassAttachmentToTarget="true"/>
<AttachTo Category="skilt"/>
<AttachTo Category="skiltfeste" DrawTail="true"/>
<AttachTo Category="signal" DrawTail="true"/>
The object type you copies probably has macros. They are elements that look like ‘<xpp:expand select=”[Macro name]”/>’, where “[Macro name]” is the name of the macro. Macros are pieces of xml code that is reused across the Dna. Most likely you want to keep some of the macros and remove some others. It’s best to look through each one.
<xpp:expand select="NOBN_com_STD_LUAEXPRESSIONS___SYMBOLFRAME"/>
<xpp:expand select="NOBN_com_STD_CUSTOMATTRIBUTES___VAR"/>
<xpp:expand select="NOBN_com_STD_TEXTATTRIBUTES___VERTICAL_AND_STACKED___TRK"/>
<xpp:expand select="NOBN_com_DISCIPLINE___BNP"/>
<xpp:expand select="NOBN_com_CHK_NUMBER_OF_OCP_AREAS"/>
<xpp:expand select="NOBN_com_SET_OCP_STATION_REFERENCE"/>
<xpp:expand select="NOBN_com_STD_LUAEXPRESSIONS___WAYSIDE_BOARD_OBJECT"/>
<xpp:expand select="NOBN_com_STD_LUAEXPRESSIONS___EARTHED_TO_NONE"/>