.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Removing LayerFilter On another Drawing

2 REPLIES 2
Reply
Message 1 of 3
gilseorin
267 Views, 2 Replies

Removing LayerFilter On another Drawing


Hi, All.

Below code is for removing layerfilter on another drawing.

It does well on current drawing, but not another drawing.

What is wrong? Some help?

Thanks in advance.



<CommandMethod("RLF")> _

Public Sub RemoveLayerFilter()

Dim dwgPath As String = "C:\RemoveLayerFilterTest.dwg"

Using TargetDb As New Database

TargetDb.ReadDwgFile(dwgPath, System.IO.FileShare.ReadWrite, True, "")

Dim lft As LayerFilterTree = TargetDb.LayerFilters

Dim lfc As LayerFilterCollection = lft.Root.NestedFilters

For i As Integer = lfc.Count - 2 To 0 Step -1

Dim lf As LayerFilter = lfc(i)

lfc.Remove(lf)

Next

TargetDb.LayerFilters = lft

End Using

End Sub

2 REPLIES 2
Message 2 of 3
NathTay
in reply to: gilseorin

You are not saving the drawing.
Message 3 of 3
gilseorin
in reply to: gilseorin

Thank you so much, NathTay.
It's working well now. Thanks again.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost