Hi
Here is sample code for creating TextBoxes in Sketch and modified ruler.ipt (rule included)
This rule creates only text boxes. You need to create engraving manually. It is possible to create it using API, but I omit it.
Number of textboxes depends on ruler length (sketch points count).
Dim part As PartDocument = ThisDoc.Document
Dim textSketch As PlanarSketch = part.ComponentDefinition.Sketches("TextSketch")
'Delete existing text boxes
While (textSketch.TextBoxes.Count>0)
textSketch.TextBoxes(1).Delete
End While
'Create new textboxes to hole center sketch points
'(This is type of sketch point, not necessary center of hole)
Dim i As Integer = 1
For Each skPoint As SketchPoint In textSketch.SketchPoints
If Not skPoint.HoleCenter Then Continue For
Dim txtBox As Inventor.TextBox = textSketch.TextBoxes.AddFitted(skPoint.Geometry, i.ToString(),"DEFAULT-ANSI")
txtBox.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextMiddle
txtBox.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
i+=1
Next