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.

This:

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
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

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

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

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)
	listNames.append(name)
	listRGB.append(rgb)
	lineWeight.append(weight)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = lineStyleSubTypes, listNames, listRGB, lineWeight
3 Likes

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: http://forums.autodesk.com/t5/revit-api/how-to-set-line-pattern-in-line-style/td-p/3731078

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