The WorkAxes.AddByRevolvedFace method will only work when creating a WorkAxis in the context of a part, but will not work when creating one in the context of an assembly. The online documentation for that method (and most other similar methods) tell us this. So, when we are creating a WorkAxis in the context of an assembly, the only option we have is the WorkAxes.AddFixed method. The AddFixed method wants us to specify an Inventor.Point type object, then an Inventor.UnitVector object. When we have selected a face using the 'Pick' function and the 'SelectionFilterEnum.kPartFaceCylindricalFilter' selection filter, and confirmed that we actually picked something, then we can be confident that the face we selected is cylindrical in shape. Keep in mind that if we are using the Pick function while an assembly is the active document, the face will be a FaceProxy instead of a regular Face, but in this case, we actually want to be working with the proxy, so that the WorkAxis will be created in the correct location within the context of the assembly. When we have a cylindrical face, then its 'Geometry' property should return an Inventor.Cylinder type object. But if not sure about that, you can always check the Face.SurfaceType property's value, which will be a variation of the SurfaceTypeEnum. So, we can create a Cylinder Type variable, then set its value with that Face.Geometry property, then use that variable to access the properties of that Cylinder object. The 3 main properties of a Cylinder are its BasePoint which has an Inventor.Point type value, its AxisVector which has a UnitVector type value, and its Radius which has a Double type value. Two of those (BasePoint & AxisVector) we can use as inputs into that WorkAxes.AddFixed method. Since the WorkAxis is being created as 'Fixed', it will not move or update if/when the component with the cylindrical face moves. As mentioned before, we can later run a rule that will find that cylindrical face again, then find that existing fixed WorkAxis, get its 'definition', then attempt to change its location and direction to be the same as the cylindrical face, but we can not change how the WorkAxis is 'defined' to be truly 'associative' to that cylindrical face so that it will move with it. I have attempted to use the WorkAxis.SetByRevolvedFace method on the pre-existing fixed WorkAxis before to associate it with a cylindrical face after the fact, but it would always throw an error instead of work, because it is in the context of an assembly. If you do not want to use the center axis of a cylinder as the input for the AddFixed method, you can attempt to create the UnitVector from scratch instead, using the TransientGeometry.CreateUnitVector method instead.
Wesley Crihfield

(Not an Autodesk Employee)