Get all project Line Styles and attributes

I’m using Archi-lab to get all project Line Styles, however it shows no meta data which I need, it simply returns a Revit GraphicStyle object. I need each styles Line Weight, Colour and Style. Whats the trick?

Can you please post a screen capture of what you currently have? It will be easier to help you with that.


So I’ve managed to get the RGB and Names with Python/Revit API, so I’m confident I can extract the Pattern and projection

If you find it, please let us know :slight_smile:
So far I can only find name and color in API

1 Like

Could you perhaps share with the group your solution?

1 Like

Heres the python script. I cant find any methods to extract the other data, so T_Pover, hopefully you can now sleep tonight :slight_smile: . Be good to get input from anyone more adept in the wonderful world of the Revit API:

import clr
from Autodesk.DesignScript.Geometry import *

# Import ToDSType(bool) extension method
import Revit

# Import geometry conversion extension methods

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

# Start Transaction

lineStyle = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Lines)
lineStyleSubTypes = lineStyle.SubCategories

listNames = []
listRGB = []
lineWeight = []
for i in lineStyleSubTypes:
	name = i.Name
	rgb = [i.LineColor.Red, i.LineColor.Green, i.LineColor.Blue]
	weight = i.GetLineWeight(GraphicsStyleType.Projection)

# End Transaction

OUT = lineStyleSubTypes, listNames, listRGB, lineWeight

I don’t think that will be a problem :slight_smile:

It seems like it is possible in Revit 2017 using the new Category.SetLinePatternId method:

1 Like

Do you know if it is possible to change a name of a Line Style (Graphics Style name)? I fail to do it.

Hi @PawelP

Could you please a new thread this topic is already solved. Thanks :slight_smile:

1 Like