Sub Category Properties

dynamo
python

#1

Hi all,
Anyone know how to get all properties of Sub-Category in Family like: Line Weight(Projection, Cut), Line Color, Line Pattern, Material? I would like to get all value and transfer it to another family. Thanks for your help!


#2

I found the Script in Forum can be extract the Properties in Subcategory from @ jmmiller but anyone know how to transfer all the Properties setting to another family document? Thanks.

Here is the Python Script.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
cat = UnwrapElement(IN[0])
subcat = cat.SubCategories

listNames = []
listPattern = []
patname = []
listout = []
listpatid = []
lineweight = []
lineweightcut = []

for i in subcat:
name = i.Name
listNames.append(name)
id = i.GetLinePatternId(GraphicsStyleType.Projection)
pat = LinePatternElement.GetLinePattern(doc,id)
listPattern.append(pat)
listpatid.append(id)
weight = i.GetLineWeight(GraphicsStyleType.Projection)
weightcut = i.GetLineWeight(GraphicsStyleType.Cut)
lineweight.append(weight)
lineweightcut.append(weightcut)
try:
patname.append(pat.Name)
except:
patname.append("Solid")

style = i.GetGraphicsStyle(GraphicsStyleType.Projection)
listout.append(style)

OUT = listout, listNames, listPattern, patname, lineweight, lineweightcut

#3

Not sure Dynamo is required here.

Something to try: Bring all the families you want to equalize into a Revit project started from your template. Set the graphics for new categories. Save out the family library. Use the new library as the family, archiving the old versions. Delete all model elements. Purge the unused families. Save the template to ensure graphic changes are set.


#4

Thanks @JacobSmall, Its useful but that isn’t exactly what I need, I expect use the function Transfer Project Standards via Dynamo, I have 100s family need to apply sub category with properties applied (Lineweight, LineColor, Material).

I have got success transfer with Lineweight and Linepattern but others none. It seem API is not supported it for category.


#5

I have many nodes for families and I have nodes for subcategories as well… this should be doable to combine.


#6

Thanks Erik, your package is very beautiful, I usually use it which very helpful for my work, I’d appreciate what you’ve done for that. Unfortunately, it is not match in this case.


#7

So what you are saying is, that I miss something there handles lines!?

I am quite busy at the moment preparing next semester, so I have to postpone all the nice coding challenges to later, but don’t hesitate to put ideas up on my wishlist at GitHub :slight_smile:


#8

Hi,

There is a node in Genius Loci package to set the SubCategories but it works in the project environment.


#9

I was looking for nodes in your package but I cant find the nodes can achieve my goal or I missed some thing? I hope you can make perfect your package in future. Your package is really useful, thanks so much.


#10

Wow, that is nearly total finish my work. Unfortunately, lacking Material and working in Project Eviroment but I will try in Family Project. Thank you very much!


#11

I dont know what you mean? if you have my package, then you should know that you get it at GitHub and not at the package manager!?

anyway using two of my nodes and the combine it with @john_pierson nodes i the Rhythm package…
subcat-line.dyn (10.0 KB)


#12

Thanks for your help, Erik. May I ask you do you know anyway to apply the category setting (all setting: line weight, line color, line pattern, material) in one family (blank family) to other families (included model) and overwrite it via Dynamo? Is it able or not? I mean your package have this function?


#13

I tried this one but it isn’t work as I expected, maybe I use wrong. Nothing happened.