Script for placing guitar frets

 From:  Martin (MARTIN3D)
5440.1 
I was able to modify the CenterAtOrigin script to help modelling guitars.
The script places 24 frets at their correct locations for a scale length of 25.5”.
For a different scale length just change the number after “var scaleLength =“
Scale lengths must be entered in inches.

Instructions
- Copy the script below to the clipboard
- Open the attached MoI file
- Set Options > Unit System: Millimeters
- Select the fret
- Hit the TAB key
- Paste the script and hit ENTER



- Start the fretboard at the center of the first fret and delete the latter.


Cut the fretboard to the desired shape using Boolean Diff


script: var scaleLength = 25.5; var distanceFromNut = 0; var distanceToNextSlot; var fretslot; 
var objects = moi.geometryDatabase.getSelectedObjects(); 
var bbox = objects.getHighAccuracyBoundingBox(); var pt = bbox.center; var factory; 
for ( var i = 0; i < 24; i++ ) { distanceToNextSlot = (scaleLength * 25.4 - distanceFromNut) / 17.8171537451058; 
distanceFromNut += distanceToNextSlot; pt.x += distanceToNextSlot; factory = moi.command.createFactory( "copy" ); 
factory.setInput( 0, objects ); factory.setInput( 1, bbox.center ); factory.setInput( 2, pt ); factory.commit(); }