Hello folks,
I'm sure this is a common problem, but we have Revit files that have accumulated a lot of junk Line Styles and Patterns over the years. I would like to be able to compare what we've got, so that I can eventually merge the duplicates (or essentially duplicates) and purge the unused.
I am comfortable enough with Dynamo to be able to get an exported Excel document with all of my Line Styles, which includes the Category Name, Line Weight, and Line Color, but the Line Patterns only come out as "LinePatternElement" (not "Center," "Dash," or "Demolished," for example). My first wish would be to get this broken out so that the name of the Line Pattern is exported as well. Maybe I am just misunderstanding this part of the node (from Bimorph), so if anyone can help me there, I would appreciate that.
My second wish is that I could export the Dash, Dot, Space values of each Line Pattern for comparison. For example, I have a Line Pattern named "Center" that goes [1/4" Dash, 3/16" Space, 5/8" Dash, 3/16" Space], but along the way someone also created a Line Pattern named "Center 5/8"" that goes [5/8" Dash, 3/16" Space, 1/4" Dash, 3/16" Space]. These Line Patterns are identical, but with a different starting point, which is totally unnecessary, and there are dozens of other similar examples. If I could get an Excel document showing the different values for Dash, Dot, and Space, I'm confident I could pare these down significantly.
I've attached screenshots of my current graph and the resulting Excel output. Any help would be appreciated! I am still a bit of a Dynamo rookie (and totally new to Revit API), but am willing to learn to get this resolved.
If you cannot get more information using Dynamo, try using RevitLookup, as an additional tool for your task.
With RevitLookup you can find the list of line patterns, and then the settings of each segment of each line pattern. It does not have an Export button, but you can see all the data in the dialog box.
Hi,
For the LinePatternElement you can use this script inside a Python Script node:
# Load required libraries
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
# Get the current document from Revit
doc = DocumentManager.Instance.CurrentDBDocument
# Filter for all LinePatternElements in the document
collector = FilteredElementCollector(doc).OfClass(LinePatternElement)
# Create lists to store elements and names
linePatterns = []
names = []
for pattern in collector:
linePatterns.append(pattern)
names.append(pattern.Name)
# Package results in a dictionary for clearer output
output = {
'LinePatternElements': linePatterns,
'Names': names
}
# Assign the output to the OUT variable
OUT = output
Select Accept as Solution and Likes are always welcome.
Ralph den Haan, (Lazy) BIM Specialist
Thanks Ralph, this is definitely a step in the right direction. A few questions/issues:
1) The "linePatterns" / "LinePatternElements" list is a bit worthless -- it has a similar issue as the original Bimorph node, where it only outputs a list of the phrase "LinePatternElement" over and over. Maybe this is just an issue on my end -- let me know if it is different for you.
Below this first list, I get a list that looks like your original screenshot, which is a full export of the Line Patterns in the project, which is a great step in the right direction, though I can't seem to discern what order they are in. Then again, it is not clear what order the original list from Bimorph is in either.
However...
2) What I really need is the list of Line Patterns that are actually used, in the same order as the Line Styles menu. Your script is pulling all the Patterns in the project, but not the Patterns that are actually assigned to any Style.
Also, in order to export this list to Excel, I had to remove some of your code that packaged things into a dictionary. I removed a few lines of code (17, 21, 23-28) and changed line 31 to read [OUT = names] instead.
I've attached the latest version of this graph, which is currently outputting to Excel three columns from the Line Styles menu and a fourth column that includes all the Line Patterns used in the project. I disconnected the Bimorph GraphicsStyle node as well, because it does not provide anything valuable.
Thanks again for everyone's input and help so far.
Hi,
I can try to check it for you later, but have you asked your question on the dynamo forums yet?
Select Accept as Solution and Likes are always welcome.
Ralph den Haan, (Lazy) BIM Specialist
Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.