Filtering Line Styles

Filtering Line Styles

mseiser
Contributor Contributor
13,720 Views
20 Replies
Message 1 of 21

Filtering Line Styles

mseiser
Contributor
Contributor

I did do some research on this question but the posts were 6 to 10 years old so I thought I would ask. We wanted to be able to halftone some line styles based on their name. Since we can only halftone the Lines category as a whole and not individually, we tried a filter but Lines do not show up there either. In the newer versions of Revit, is there a setting other than "Override Object by Element" that will automatically halftone a line style?

 

If there is not, I would really like a valid reason as to why this is not possible?? This seems like a no brainer option to me and am very surprised we can't do this.

 

Thanks

0 Likes
Accepted solutions (1)
13,721 Views
20 Replies
Replies (20)
Message 2 of 21

ToanDN
Consultant
Consultant

You can change the color to specific Line Styles to make them halftone-like. 

0 Likes
Message 3 of 21

mseiser
Contributor
Contributor
We have the print setting set to Blacklines so that doesn’t work well either. Thanks for the reply 😊
0 Likes
Message 4 of 21

Viveka_CD
Alumni
Alumni

@mseiser

 

Are you printing to PDF? Is so which PDF printer are you using?

You can assign a specific line style you want to use for an element and modify them in your VV setitngs.

 

If you print using black lines, any lines you set as "halftone" will print as gray.

 

Regards,

Message 5 of 21

mseiser
Contributor
Contributor
Hi,
Once the lines are manually set using the “Override By Elements” command then they halftone just fine……But that is extra work for one and if a detail is copied these setting go back to the default in the new view. We wanted to have the line style always be halftoned without having to set or reset them.
For example: My hope was to have two lines styles for this Line Style, “S-DET-25” and “(E) S-DET-25” where “(E) S-DET-25” would halftone using a filter (which is apparently not possible). When “S-DET-25” is used it stays black, if the other is used is will already be halftoned. Currently we need to draw the line, select, Right click and use this [cid:image005.jpg@01D3B701.07836BE0] and [cid:image006.jpg@01D3B701.07836BE0] . What a pain, right?
We tried staying all Black lines and using color in the print settings but 61 users really got really grouchy living in this black and white world 😊.
It would be nice if Autodesk allowed us to either filter these line styles or allow for halftoning the line styles individually in the Visibility Graphics (Currently that’s not possible). Per the pic below. The lines category can be set but nothing below that. It’s all or nothing. Why would anyone think that was a good idea?[cid:image007.png@01D3B700.F5C50850]
Thanks for responding 😊
Message 6 of 21

Viveka_CD
Alumni
Alumni

Hi @mseiser

 

Thanks for getting back.

 

Unfortunately I can see the pictures, please try attaching them again.

 

Regards,

 

0 Likes
Message 7 of 21

ToanDN
Consultant
Consultant
You can isolate the line styles and create a selection filter. It can be made halftoned just like criteria filters.
0 Likes
Message 8 of 21

mseiser
Contributor
Contributor
Good Morning,
Can you expand on this? I know about the selection filter but how can you save that? Then add a filter to it? Hopefully this isn’t a hand to forehead moment 😊.
0 Likes
Message 9 of 21

Viveka_CD
Alumni
Alumni
Accepted solution

@mseiser

 

Here's a step by step process on Filtering Model Lines in Revit

Also, please share your pictures again, we can help you better!

 

Thanks,

Message 10 of 21

mseiser
Contributor
Contributor

I gave this a try but as I suspected, the lines still come out black since we have the print setting set to black lines. The halftone option using "Override by element" appears to be the only option that works. We do use mostly components to build details but there are cases with TI's or Existing building retros that require us to need Lines that are shaded back. We were just trying to use the Tool (Revit) to help make this more efficient....but we were denied.....It would be nice to see more flexibility with lines in the future. Buildings are just not that black and white, colors are truly a great QC tool which is why we use the Black Lines setting for printing 🙂 

 

Thanks for your patience and help.

0 Likes
Message 11 of 21

ToanDN
Consultant
Consultant

Please see screencast for a simple demonstration.

 

https://knowledge.autodesk.com/community/screencast/9b8e7123-cbbe-4a99-9945-67218b401662

 

 

 

 

Message 12 of 21

RPTHOMAS108
Mentor
Mentor

@mseiser have written this simple application macro to set all lines of a given linetype style to halftone or not. You first select one of the line or lines containing the styles you want to be halftone and then press 'Yes' to set as halftone in the view and 'No' to remove halftone.

 

Works by overriding element graphical settings in view rather than by category which as you've mentioned can't be done.

 

You just need to create a new VB application module (any name)

Capture1003b.PNG

Insert the text below

Compile the macro

Capture1003c.PNG

 

 

Run by either double clicking the macro name or run button within the macro manager window.

 

 


' ' Created by SharpDevelop. ' User: Richard ' Date: 10/03/2018 ' Time: 20:07 ' ' To change this template use Tools | Options | Coding | Edit Standard Headers. ' Imports System Imports Autodesk.Revit.UI Imports Autodesk.Revit.DB Imports Autodesk.Revit.UI.Selection Imports System.Collections.Generic Imports System.Linq <Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)> _ <Autodesk.Revit.DB.Macros.AddInId("9579F215-299D-405D-B7D4-C255C5EC894A")> _ Partial Public Class ThisApplication Private Sub Module_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup End Sub Private Sub Module_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown End Sub Public Sub SetHalftone Dim Doc As Document = ActiveUIDocument.Document Dim R As iList(Of Reference) = Nothing Try R = ActiveUIDocument.Selection.PickObjects(ObjectType.Element, New IFiltLineFilter,"Select lines containing graphics style used as key") Catch ex As Exception End Try If R Is Nothing Then Exit Sub Else Dim TD As New TaskDialog("Halftone") TD.MainInstruction = "Set halftone?" TD.MainContent = "Yes to set, no to remove." TD.AllowCancellation = True TD.CommonButtons = TaskDialogCommonButtons.Yes + TaskDialogCommonButtons.No Dim TDR As TaskDialogResult = TD.Show() Select Case TDR Case Is = TaskDialogResult.Yes, TaskDialogResult.No Case Else Exit sub End Select Dim Curvs As IEnumerable(Of ElementId) Curvs = From J As Reference In R Let Cl As CurveElement = TryCast(Doc.GetElement(J), CurveElement) Where Cl Is Nothing = False Select Cl.LineStyle.Id Dim Cx As List(Of ElementId) = Curvs.ToList Dim FEC As New FilteredElementCollector(Doc, Doc.ActiveView.Id) Dim ECF As New ElementCategoryFilter(BuiltInCategory.OST_Lines) Dim Els As IList(Of Element) = FEC.WherePasses(ECF).ToElements Dim OGS As New OverrideGraphicSettings() OGS.SetHalftone(TDR = TaskDialogResult.Yes) Using Tx As New Transaction(Doc, "Set halftone") If Tx.Start = TransactionStatus.Started Then For Each c As Element In Els If c.GetType.IsSubclassOf(GetType(CurveElement)) Then Dim CE As CurveElement = DirectCast(c, CurveElement) If Cx.Contains(CE.LineStyle.Id) Then Doc.ActiveView.SetElementOverrides(c.Id, OGS) End If End If Next Tx.Commit() End If End Using End Sub Private Class IFiltLineFilter Implements Autodesk.Revit.UI.Selection.ISelectionFilter Public Function AllowElement(elem As Element) As Boolean Implements Autodesk.Revit.UI.Selection.ISelectionFilter.AllowElement If elem.GetType.IsSubclassOf(GetType(ModelCurve)) Then Return True Else If elem.GetType.IsSubclassOf(GetType(DetailCurve)) Then Return True Else Return False End Function Public Function AllowReference(reference As Reference, position As XYZ) As Boolean Implements Autodesk.Revit.UI.Selection.ISelectionFilter.AllowReference Return True End Function End Class End Class

 

Message 13 of 21

RPTHOMAS108
Mentor
Mentor

Updated the code as original problem was to select all lines by pattern not category, have this option as tick box now.

 

'
' Created by SharpDevelop.
' User: Richard
' Date: 10/03/2018
' Time: 20:07
' 
' To change this template use Tools | Options | Coding | Edit Standard Headers.
'
Imports System
Imports Autodesk.Revit.UI
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.UI.Selection
Imports System.Collections.Generic
Imports System.Linq

<Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)> _
<Autodesk.Revit.DB.Macros.AddInId("9579F215-299D-405D-B7D4-C255C5EC894A")> _
Partial Public Class ThisApplication
    Private Sub Module_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
	End Sub
	Private Sub Module_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
	End Sub
    
    Public Sub SetHalfTone
    	
        If ActiveUIDocument Is Nothing Then Exit sub Else 
        Dim Doc As Document = ActiveUIDocument.Document

        Dim R As IList(Of Reference) = Nothing
        Try
            R = ActiveUIDocument.Selection.PickObjects(ObjectType.Element, New IFiltLineFilter)
        Catch ex As Exception
        End Try
        If R Is Nothing Then Exit sub Else 

        Dim TD As New TaskDialog("Halftone")
        TD.MainInstruction = "Set halftone?"
        TD.MainContent = "Yes to set, no to remove."
        TD.AllowCancellation = True
        TD.CommonButtons = CType(TaskDialogCommonButtons.Yes + TaskDialogCommonButtons.No, TaskDialogCommonButtons)
        TD.ExtraCheckBoxText = "Match by line pattern only, not category"

        Dim TDR As TaskDialogResult = TD.Show()

        Select Case TDR
            Case Is = TaskDialogResult.Yes, TaskDialogResult.No
            Case Else
               Exit sub
        End Select

        Dim GetGL = Function(CurveElem As CurveElement) As ElementId
                        Dim GSY As GraphicsStyle = DirectCast(CurveElem.LineStyle, GraphicsStyle)
                        If TD.WasExtraCheckBoxChecked Then
                            Dim DSCat As Category = GSY.GraphicsStyleCategory
                            Dim LPatId As ElementId = DSCat.GetLinePatternId(GraphicsStyleType.Projection)
                            Return LPatId
                        Else
                            Return GSY.Id
                        End If
                    End Function
     
        Dim Ids As IEnumerable(Of ElementId)
        Ids = From J As Reference In R
            Let Cl As CurveElement = TryCast(Doc.GetElement(J), CurveElement)
            Where Cl Is Nothing = False
            Select GetGL(Cl)

        Dim Cx As List(Of ElementId) = Ids.ToList

        Dim FEC As New FilteredElementCollector(Doc, Doc.ActiveView.Id)
        Dim ECF As New ElementCategoryFilter(BuiltInCategory.OST_Lines)
        Dim Els As IList(Of Element) = FEC.WherePasses(ECF).ToElements

        Dim ElsToChange As IEnumerable(Of ElementId)
        ElsToChange = From J As Element In Els
            Let Cl As CurveElement = TryCast(J, CurveElement)
            Where Cl Is Nothing = False
            Where Ids.Contains(GetGL(Cl))
            Select J.Id

        Dim OGS As New OverrideGraphicSettings()
        OGS.SetHalftone(TDR = TaskDialogResult.Yes)

        Using Tx As New Transaction(Doc, "Set halftone")
            If Tx.Start = TransactionStatus.Started Then
                For Each c As Element In Els
                    If c.GetType.IsSubclassOf(GetType(CurveElement)) Then
                        For Each item As ElementId In ElsToChange
                            Doc.ActiveView.SetElementOverrides(item, OGS)
                        Next
                    End If
                Next
                Tx.Commit()
            End If
        End Using
         	
    End Sub
    
    Private Class IFiltLineFilter
        Implements Autodesk.Revit.UI.Selection.ISelectionFilter

        Public Function AllowElement(elem As Element) As Boolean Implements Autodesk.Revit.UI.Selection.ISelectionFilter.AllowElement
            If elem.GetType.IsSubclassOf(GetType(ModelCurve)) Then Return True Else 
            If elem.GetType.IsSubclassOf(GetType(DetailCurve)) Then Return True Else 
            Return False
        End Function

        Public Function AllowReference(reference As Reference, position As XYZ) As Boolean Implements Autodesk.Revit.UI.Selection.ISelectionFilter.AllowReference
            Return True
        End Function
    End Class
	
End Class

 

Message 14 of 21

gertjan
Explorer
Explorer

The reason I use filters a lot, is because I work with linked models (in this case seven linked models). I'd like to filter a model line which is in all linked models, and then put the filter in a view template when needed. Of course I can do an override. If it's not really important, I like to keep it 'by host view', and one filter is better than seven manual overrides. And besides, a filter once created can be used in other templates as well.

So, I'd be really happy to be happy to filter lines.

Message 15 of 21

Nate.Ritta
Enthusiast
Enthusiast
This does not work because print settings are set to Blackline. Revit needs the functionality to assign halftone in a view's visibility/graphics override menu for each individual line type, not just for all lines in general. Or line types need to be added as options for creating selection filters.
0 Likes
Message 16 of 21

ToanDN
Consultant
Consultant
Instead of drawing lines directly, create an in place model and draw lines in it, then you can create a filter to halftone the model.
Message 17 of 21

mseiser
Contributor
Contributor

In my case, I am working in Drafting views where in-place models aren't allowed...as far as I can see. We do use a lot of components where we added an "Existing" parameter that filters the component to halftone when checked, but we still need an occasional line which we have to manually change by element. This is an issue when copying a detail for similar conditions or modify the line. When this happens we have to manually change those settings again. We also do a lot of Modular work where we need the same detail, one for MOD stuff and one for site-built. We halftone to differentiate between the two.....you see why filtering can be very beneficial in making this much more efficient and reliable. It seems like all Autodesk has to do is turn this feature on in the Visibility Graphics.......how hard can it be?? 🙂

Message 18 of 21

Nate.Ritta
Enthusiast
Enthusiast

Good suggestion for a work-around.  I will give it a try.  I also have used selection set filters, which I assume would work similarly to an in-place model.  Wouldn't it be nice, though, if Autodesk just adjusted this feature so we didn't have to rely on work-arounds for basic functionality like halftoning a specific line type? 

0 Likes
Message 19 of 21

MEP-guy
Observer
Observer

Totally agree. I don't see any reason why Revit couldn't filter lines based on their name. This is very useful when cleaning up CAD files. You have to remember there are a large number of firms still using autocad as their backgrounds, and being able to quickly turn on and off different line types based on their name (layer name in CAD) is a game changer. We could create a dynamo graph to select lines based on their name, then use the same selection criteria to create a selection set and selection filter inside Revit. We could then add any graphic override we want (turn on or off the lines, color them, etc). We would have to run the graph each time, but it would save firms hours of time that is usually spent cleaning up CAD files. BUT, Revit should really consider adding this feature in Revit. I also need to learn dynamo...

Message 20 of 21

mseiser
Contributor
Contributor

And that is another good reason for allowing filtering of Line Styles. In the end we are pressured to be faster and stay accurate. Anything added to to a model or document is data and should be filterable, lines included.

This is a very old post and Autodesk still hasn't considered this feature.....how hard can this be?? 

0 Likes