I’m setting DWG line widths using object styles (thanks @Thomas_Mahon unfortunately the views are ignoring those settings, so i need to use visibility graphics…
However I can’t see an API method for this, would anyone be able to assist? Visibility is there and colour, but not line weight?
Just incase you’re interested… The goal was to align lineweights in dwgs with the company colour table…It was a bit tricky, because I needed to extract the sub category colours which related to the dwg links I’m interested in…
#thanks to Konrad and Luke J
import clr
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# toProtoType etc.
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import System
nameEquals = IN[0]
gStyles = FilteredElementCollector(doc).OfClass(GraphicsStyle).ToElements()
#we need to get the name of the gStyle so we can filter to get the dwgs.... all the dwgs names will end in dwg
gStyleDwgCategoryList = []
for i in gStyles:
if "dwg" in i.GraphicsStyleCategory.Name:
gStyleDwgCategoryList.append(i.GraphicsStyleCategory)
gStyleCategoryList = []
gStyleCategoryListName = []
#gStyleCategoryListColour = []
i = 0
while i < len(nameEquals):
gStyleCategorySubList = []
gStyleCategorySubListName = []
gStyleCategorySubListColour = []
for gSCat in gStyleDwgCategoryList:
if nameEquals[i] in gSCat.Name:
gStyleCategorySubList.append(gSCat)
gStyleCategorySubListName.append(gSCat.Name)
# gStyleCategorySubListColour.append(gSCat.LineColor)
i = i + 1
gStyleCategoryList.append(gStyleCategorySubList)
gStyleCategoryListName.append(gStyleCategorySubListName)
# gStyleCategoryListColour.append(gStyleCategorySubListColour)
gStyleName = []
gStyleColour = []
for gSubL in gStyleCategoryList:
gStyleSubCategories = []
for gL in gSubL:
gStyleSubCategories.append(gL.SubCategories)
gStyleSubCategoriesList = [[] for i in range(0, len(gStyleSubCategories))]
gStyleSubCategoriesListClr = [[] for i in range(0, len(gStyleSubCategories))]
for index, item in enumerate(gStyleSubCategories):
for i in item:
gStyleSubCategoriesList[index].append(i.Name)
for index, item in enumerate(gStyleSubCategories):
for i in item:
gStyleSubCategoriesListClr[index].append(i.LineColor)
gStyleName.append(gStyleSubCategoriesList)
gStyleColour.append(gStyleSubCategoriesListClr)
OUT = gStyleCategoryListName, gStyleName, gStyleColour