By Aaron Lu
I was asked a problem about create Cross Fitting,
I remember that the cross fitting creation method Document.Create.NewCrossFitting needs 4 connectors as arguments, the order of those connectors is not arbitrary, as Jeremy said in this post http://thebuildingcoder.typepad.com/blog/2014/10/newcrossfitting-connection-order.html, it should be main-main-side-side rather than main-side-main-side.
But when I got the file and test it, it always throws InvalidOperationException: failed to insert cross, no matter what order I tried.
Autodesk.Revit.Exceptions.InvalidOperationException: failed to insert cross.
It is wired. But fortunately I found the cause: the Routing Preference is not set for Cross.
After setting it, the problem has gone!
Pick the pipe > Edit type > Routing Preferences > Cross > select "All"
as below: