How to select override linetypes from detail views

Is there any way to select the overridden lines in detail views? For instance, in a section view, I have overridden the line style in the bottom area of floor element using linework as shown in below image. Now, I need to select that line style in Dynamo


I have try the script but linework elements are not selected

Please let me know it was very helpful for my project

What is it exactly that you’re after? You want to list the line types that have been used as Linework overrides in the view? Why are you after these line types and what do you plan to do with them?

Overrides are not lines, so they isn’t an element to get or query. You would have to check each piece of geometry for a visual override, if that’s even possible, but I don’t think the Linework tool has been added to the API yet.

Hi Nick
Thank you for the response
Do we have any python related script node to find out the linework in detail views

Hi Fayaz, you can have my nasty half complete line collector.
i’m sure someone is going to cringe at this but :neutral_face:

It filters out the non user generated lines and there is some double handling with the collector because i am working on it right now…but oh well…

EDIT
If anyone could provide me with the SetPVal method to change the linesstyles that would be appreciated :stuck_out_tongue: no drama though, i’ll find it eventually.

DOUBLE EDIT
Got it :slight_smile:

import clr

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

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

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

# Current doc/app/ui
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

LineStyles = []
LineGraphicStyle = []
LineRGB = []
LineStyleID = []
LineStyleName = []
LineUserMadeBool = []
listPattern = []
listpatid = []
patname = []
lineWeight = []

# Collect the BIC
collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Lines).ToElements()

# Isolate BIC from collection
bic = collector[0].Category
subcats = bic.SubCategories

# Determine LineUserMadeBool values
for subcat in subcats:
    subcatid = subcat.Id.IntegerValue
    subcatidasint = int(subcatid.ToString())

    if subcatidasint > 0:
        LineUserMadeBool.append(True)
    else:
        LineUserMadeBool.append(False)

# Filter subcats based on LineUserMadeBool
subcats_filtered = [subcat for subcat, usermade in zip(subcats, LineUserMadeBool) if usermade]

for subcat in subcats_filtered:
    subcatid = subcat.Id.IntegerValue
    subcatidasint = int(subcatid.ToString())
    LineStyleID.append(subcatidasint)

    subcatele = Revit.Elements.Category.ById(subcatid)
    LineStyles.append(subcatele)

    LineStyle = subcat.GetGraphicsStyle(GraphicsStyleType.Projection)
    LineGraphicStyle.append(LineStyle)

    subcatname = LineStyle.Name
    LineStyleName.append(subcatname)

    RGB = [subcat.LineColor.Red, subcat.LineColor.Green, subcat.LineColor.Blue]
    LineRGB.append(RGB)
    
    weight = subcat.GetLineWeight(GraphicsStyleType.Projection)
    lineWeight.append(weight)

    id = subcat.GetLinePatternId(GraphicsStyleType.Projection)
    pat = LinePatternElement.GetLinePattern(doc, id)
    listPattern.append(pat)
    listpatid.append(subcat)
    try:
        patname.append(pat.Name)
    except:
        patname.append("Solid")
        
#============================================================

if isinstance(LineStyleName,list):
	names = UnwrapElement(LineStyleName)
else:
	names = [UnwrapElement(LineStyleName)]
	
alllines = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Lines)

lines = []

for n in names:
	lines.append([x for x in alllines if x.LineStyle.Name == n ])

# Outputs for Dynamo
OUT = LineGraphicStyle, LineStyleName, LineRGB, patname, lineWeight, lines

Hi pyXam
Thank you for the response
If it is possible please provide dynamo script, it was very helpful for my project

Everything int he image is there. its just a python node with a codeblock to split out the different list indexes as shown.

Thank you for the response
I have copied the script information in the python node so its getting warning as shown in below imageimage|690x387
Please provide script it was very helpful for me

Are you testing this on a project that currently contains lines?

Yess we are currently testing on the project for linework
Below is the example



In the image above, I have used the linework tool to override the floor element in the section view. My intention is to know where the linework tool has been used in all views in project by using dynamo.
Please suggest us.

Hi
Don’t we need to add revit active views and active doc nodes to the dynamo ?

ooo…yeah i mis-understood.

Linework is a graphic override of an existing line. so…
if all you are wanting to do change the ovveride lines then this i suppose.

Its not an elegant solution but its as good as i can do.
P_[Override]_LinesInView.dyn (36.6 KB)

Hi pyXam
Thank you for the response. We have noticed that your script is useful for overriding selected linestyles in a view. However, we need to find out in which section views the linework override is being used.
Please suggest us.

Have a go at it yourself. Lets see how you go and maybe i can help if you get stuck.

As I mentioned, I don’t believe this is available in the API. Therefore it’s not possible. (Unless I missed it and someone can correct me.)