I am trying to write an ArcPy script which takes a user input feature class polygon and creates a custom version of a projected coordinate system based on the Orthographic projection (which has the WKID 43041) and the centroid of the polygon. All of the help pages are based on creating spatial references which are already defined Projected Coordinate Systems, but none which show how to create a new custom PCS.
I have tried various versions of creating an instance of the SpatialReference class, setting properties then using the create method, such as the following snippet of my code but I keep getting the 'Error executing function' message below.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\arcobjects\arcobjects.py", line 1226, in create
RuntimeError: ERROR 999999: Error executing function.
This is something which I find straightforward using the Data Frame Coordinate Reference System properties in ArcMap but is proving beyond me using ArcPy, so any assistance or examples of the correct code to define a custom projection gratefully received.