It’s possible to get the line pattern from Line style.
Actually, Revit API does not provide a true 'Line style' element, the line styles are actually subcategories of the Lines category. Since Revit 2017, developer can get/set the relationship between Line Style and line pattern by methods as follow:
public ElementId Category.GetLinePatternId(GraphicsStyleType graphicsStyleType)
public void SetLinePatternId(ElementId linePatternId, GraphicsStyleType graphicsStyleType)
To list the line pattern used in a line style, you can get the Lines category,
Categories categories = doc.Settings.Categories;
Category lineCat = categories.get_Item( BuiltInCategory.OST_Lines );
then iterate all the subcategories of the lineCat, and call Category.GetLinePatternId() method as shown above to get the line pattern element.
That’s the way to get line pattern from line style, but what do you exact want to get the line pattern from element? It’s not feasible without any detail background.
Btw, there are 2 nice blogs for your to reference if you are interested:
http://thebuildingcoder.typepad.com/blog/2016/10/how-to-create-a-new-line-style.html#6
http://thebuildingcoder.typepad.com/blog/2013/08/retrieving-all-available-line-styles.html
Hope it helps.
John Wu
Developer Technical Services
Autodesk Developer Network