mjmiddle
Ansys Employee

There is no published API for this. You have to do it through a call to the GUI command. Unfortunately, the recorded commands that create a datum line won't associate the datum with the selected edge, so it can't be pinned. So you also have to use a GUI command to create the datum line.

from SpaceClaim.Api.V23 import Command
selection = EdgeSelection.Create(GetRootPart().Bodies[0].Edges[462])
selection.SetActive()
Command.GetCommand("CreateDatumLine").Execute()    # the axis created will automatically be selected
Command.GetCommand("PinDatum").Execute()