There can be several reasons why a (bass-)guitar topnut needs to be replaced:
Every topnut has to be made in such way that the guitar plays comfortable, detunes as less as possible, does not make unwanted resonances, and keeps the open chords area (first few fret positions) in tune.
There are two reasons this topnut needs to be replaced:
A piece of bone is cut to size and fits nicely in the neck. A half-cut pencil is used to make a line to wich depth the string slots need to be cut, roughly.
The two outside strings are used to determ how the strings are devided on the neck. The distance to both fretboard edges are very important. The way the player uses the instrument is taken into account: does the high E string needs more space in order to not slip from the frets? does the low E string needs less space to the edge because the player uses his thumb for chords? All is taken in consideration.
The result can be an a-symmetrical string devision over the fretboard. The space between the other strings should be as equal as possible, otherwise the instrument looks clumsy and can be difficult to play. Guitar strings are further devided with a special string ruler, bass guitar string devisions are calculated and measured.
The first scratches in the bone material are being made with a very sharp file, actually normaly used to sharp saw tooth with.
The nut is further cut with special diamond coated files with the right thickness for each string. The bottom of the file is round so the string will fit nicely in the slot.
After the slots are cut roughly to the right depth, the top of the nut is cut down. This is being done by a radius sanding block with the same radius as the fretboard. The most common 'rule' for the height of the topnut is that the strings lay half of their thickness in the bone nut. Also here, the particular guitar and player is taken into account. For example, a high E string for an expressive blues player might me laying a touch deeper in the nut so it will not be played out of the nut with string bending in the lower positions.
All the sharp edges of the topnut are filed round, so the guitar is comfortable to touch. The bone is sanded and polished with micro-mesh paper.
Small adjustments can still be made in the string depth. With a feeler gauge the depth of each string is checked. Even here the playing style is considered. Heavy expressive players might need a bit more clearance than a very gentle player. In the end the first three positions are being checked for false notes. A too high topnut will always cause problems for open chords.
The finished topnut.