Hope you’re sitting down as I had to do a dive into IFC the other day for an account and learned a few things which might help you and others in the future.
IFC geometry is really crucial to understanding this problem. The IFC file structure is VERY accessible - so much so they actually provide a website to help anyone who needs to read or write IFC format. Obviously these formats vary based on decisions in the encoding process, what values were ‘included’ or not (ie: not enabling the analytical export), and more. In all cases the IFC format requires the curve location data you’re after (see axis 3d geometry). So it’s just a matter of the importer reading the data correctly and encoding it into the resulting file. However not all importers are created equally and they change over time, so you’re best bet in a Revit context is to use the most current version of Revit possible (IFC file format doesn’t align to the Autodesk release cycle so it’s more likely that Revit will miss something if you’re using older software).
Now with that out of the way, onto solving your actual problem.
Assuming your IFC has the curve contained in it and that you’re using a current Revit build (I tested on 2020.1), you can likely get the location curve directly from the imported element with an Element.Curves node. If you really need the vector not the line that’s an easy enough conversion (Curve.PointAtParameter with [0,1] as the parameters and use the points to define the vector - likely you want to reverse it if the Y component is negative).
If the IFC omitted the axis geometry and you only have a generic mesh/topology then you have to get creative with your geometry. You can try Element.Solids > Element.Verticies > Vertex.PointGeometry > Line.ByBestFitThroughPoints, which usually get you the linear axis of the beam to some extent. Things get funny if you have voids in the beam as they throw off the symmetry (you may want to pull the curve onto the topmost or bottommost surface in those cases to get the true direction) and with round tubes (where verticies may not be consistent enough for good results without some further review), but it will usually get you most of the way there where geometry manipulation is possible.
If that fails you could try matching the IFC GUID in Revit with the GUIDs in the textural formatted IFC, and see if you can pull the location curve from the text and use that to build your curve directly in Dynamo. That’s a good bit more work on your part but it’s certainly doable.
Hopefully one of those three gets you (and future visitors) where you need to go.