In Orbiter? There is an example from ScnEditor plugin:
oapiGetRelativePos (hV, hRef, &pos);
oapiGetRelativeVel (hV, hRef, &vel);
// map ecliptic -> equatorial frame
if (frm) {
MATRIX3 rot;
if (frm == 1) oapiGetPlanetObliquityMatrix (hRef, &rot);
else oapiGetRotationMatrix...