Thank you both for your replies.
I am going to try the Inventor addin, but I really need a programmatic solution.