# Delete all "Detail Lines" with a specific "Line Style" parameter" - How?

**URL:** <https://forum.dynamobim.com/t/delete-all-detail-lines-with-a-specific-line-style-parameter-how/951>\
**Category:** Packages\
**Created:** [January 21, 2015, 2:57pm UTC](https://forum.dynamobim.com/t/delete-all-detail-lines-with-a-specific-line-style-parameter-how/951 "2015-01-21T14:57:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Anderson](https://avatars.discourse-cdn.com/v4/letter/d/f475e1/32.png) [@Daniel\_Anderson](https://forum.dynamobim.com/u/Daniel_Anderson)\
**Post date:** [January 21, 2015, 2:57pm UTC](https://forum.dynamobim.com/t/delete-all-detail-lines-with-a-specific-line-style-parameter-how/951/1 "2015-01-21T14:57:42Z")

</div>

Hello All,

This is my second script, so go easy on me. I need to delete all “Detail Lines” with a specific “Line Style” parameter".

&nbsp;

For my case, the “Line Style” parameter value = “Construction”.

I installed the Eraser package, and it works great to remove all “Detail Lines” in the array, but I am trying to figure out how to edit the array to only delete the “Detail Lines” with the  
"Line Style" of “Construction”.

[https://dl.dropboxusercontent.com/u/107160035/dynamo2.JPG](https://dl.dropboxusercontent.com/u/107160035/dynamo2.JPG "Code Sample")

Thank you for any guidence.

&nbsp;

Daniel

&nbsp;

---

<div class="post-metadata">

**Author:** ![Andreas\_Dieckmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andreas_dieckmann/32/365_2.png) [@Andreas\_Dieckmann](https://forum.dynamobim.com/u/Andreas_Dieckmann)\
**Post date:** [January 21, 2015, 5:36pm UTC](https://forum.dynamobim.com/t/delete-all-detail-lines-with-a-specific-line-style-parameter-how/951/2 "2015-01-21T17:36:42Z")

</div>

Here’s how you could do it. Basically it’s just a matter of filtering.  
 ![delete by linestyle](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/b/b552f81658bb29303cfecc063dbd5a760f4d7339.png)

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [January 21, 2015, 5:48pm UTC](https://forum.dynamobim.com/t/delete-all-detail-lines-with-a-specific-line-style-parameter-how/951/3 "2015-01-21T17:48:11Z")

</div>

Daniel,

You were close, or rather on a good path. Here’s how i solved this:

&nbsp;

![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/1X/361d5bfea8ee071e61150501b3852f92ee51303b.png)

Explanation:

You had a good idea to collect all lines using the Category OST\_Lines and then query them for Line Style parameter. What that returns however, is an ElementId object. That’s an Id of a Line Style type that was assigned to the given Detail Line. Now in order to filter out just the ones with a Line Style called (named) “Construction” or in my example 1-Dash you need a few things. First I used a custom Python node to get the Line Style itself and then then queried it for an Id. I am using an [archi-lab](https://forum.dynamobim.com/t/revit-2022-dynamo-2-10-package-not-showing-up-and-icons-missing/62933/7?) ElementId node here since it returns an ElementId object instead of integer object like the standard Element.Id node does in Dynamo. Objective is to use that style Id and compare it to one that we got returned from Element.GetParameterValueByName node (remember I said it returns an ElementId so its important that we have two matching data types if we want to compare them. you cannot compare an integer to ElementId object). Then I am using Equals node to create a list of True/False values that tell me which lines have the desired line style. Use List.FilterByBooleanMask to get only lines that have desired style assigned and then just delete it. I am again using a custom node from [archi-lab](https://forum.dynamobim.com/t/revit-2022-dynamo-2-10-package-not-showing-up-and-icons-missing/62933/7?) package.

You can get the [archi-lab](https://forum.dynamobim.com/t/revit-2022-dynamo-2-10-package-not-showing-up-and-icons-missing/62933/7?) package from the package manager and for that one custom node, the code is below. I will eventually make that into a custom node and add to [archi-lab](https://forum.dynamobim.com/t/revit-2022-dynamo-2-10-package-not-showing-up-and-icons-missing/62933/7?) package so check back in the near future.

> #Copyright(c) 2015, Konrad Sobon # @arch\_laboratory, http://archi-lab.net
> 
> import clr  
> clr.AddReference(‘ProtoGeometry’)  
> from Autodesk.DesignScript.Geometry import \*
> 
> # Import DocumentManager and TransactionManager
> 
> clr.AddReference(“RevitServices”)  
> import RevitServices  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager
> 
> # Import RevitAPI
> 
> clr.AddReference(“RevitAPI”)  
> import Autodesk  
> from Autodesk.Revit.DB import \*
> 
> doc = DocumentManager.Instance.CurrentDBDocument  
> uiapp = DocumentManager.Instance.CurrentUIApplication  
> app = uiapp.Application
> 
> from System.Collections.Generic import \*
> 
> #The inputs to this node will be stored as a list in the IN variable.  
> dataEnteringNode = IN
> 
> name = IN[0]
> 
> lineStyles = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST\_Lines)  
> lStyle =   
> try:  
> lStyle.append(next(i.LineStyle for i in lineStyles if name==i.LineStyle.Name))  
> except StopIteration:  
> pass
> 
> OUT = lStyle[0]
> 
> &nbsp;

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [January 21, 2015, 5:58pm UTC](https://forum.dynamobim.com/t/delete-all-detail-lines-with-a-specific-line-style-parameter-how/951/4 "2015-01-21T17:58:08Z")

</div>

Andreas, nice one! SteamNodes, Clockwork and archi-lab showcasing the power of custom nodes. 🙂

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [January 21, 2015, 6:30pm UTC](https://forum.dynamobim.com/t/delete-all-detail-lines-with-a-specific-line-style-parameter-how/951/5 "2015-01-21T18:30:10Z")

</div>

> #Copyright(c) 2015, Konrad Sobon # @arch\_laboratory, http://archi-lab.net
> 
> import clr  
> clr.AddReference(‘ProtoGeometry’)  
> from Autodesk.DesignScript.Geometry import \*
> 
> # Import DocumentManager and TransactionManager
> 
> clr.AddReference(“RevitServices”)  
> import RevitServices  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager
> 
> # Import RevitAPI
> 
> clr.AddReference(“RevitAPI”)  
> import Autodesk  
> from Autodesk.Revit.DB import \*
> 
> doc = DocumentManager.Instance.CurrentDBDocument  
> uiapp = DocumentManager.Instance.CurrentUIApplication  
> app = uiapp.Application
> 
> from System.Collections.Generic import \*
> 
> #The inputs to this node will be stored as a list in the IN variable.  
> dataEnteringNode = IN
> 
> name = IN[0]
> 
> lineStyles = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST\_Lines)  
> lStyle =   
> try:  
> lStyle.append(next(i.LineStyle for i in lineStyles if name==i.LineStyle.Name))  
> except StopIteration:  
> pass
> 
> OUT = lStyle[0]

  
Here’s a small modification and an extra filter to get only Detail Lines.

![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/e/eec76c829072201f809298bb93f07d00f68fb2cf.png)
