Visual Basic Customization

Visual Basic Customization

Reply
Valued Contributor
lanieuwe
Posts: 57
Registered: ‎10-26-2011
Message 1 of 2 (182 Views)

Why does the locked layers not fading with vba?

182 Views, 1 Replies
12-29-2012 07:12 AM

I have this application:

It's a userform with a combobox filled up with all layers. There also are 2 commandbuttons and a label.

When I apply the command button all the layers except the selected layer in the combobox lock. That's good.

This is the problem:

Normaly when I lock a layer it is fading (laylockfadectl 80). But when I lock layers with this vba code it doesn't fading locked layers. Can someone help?

 

gr. laszlo

Option Explicit

Private Sub cmbx1_Change()
Label1.Caption = cmbx1.Value
End Sub

Private Sub cmdAPPLY_Click()
On Error Resume Next 'handle exceptions inline
Dim objlayers As AcadLayers Dim objlayer As AcadLayer
Set objlayers = ThisDrawing.Layers 'make the layer selected in the combobox current ThisDrawing.ActiveLayer = objlayers.Item(cmbx1.Text) For Each objlayer In objlayers objlayer.Lock = True 'lock all the layers Next objlayer Set objlayer = objlayers.Item(cmbx1.Text) If objlayer Is Nothing Then MsgBox "layer does not exist" Exit Sub 'exit if layer not found End If objlayer.Lock = False 'unlock the desired layer End Sub Private Sub cmdEXIT_Click() Dim objlayer As AcadLayer
For Each objlayer In ThisDrawing.Layers objlayer.Lock = False Next Unload frm1 End Sub
Private Sub Label1_Click() On Error Resume Next 'handle exceptions inline Dim objlayers As AcadLayers Dim objlayer As AcadLayer
Set objlayers = ThisDrawing.Layers Me.Caption = objlayers.Item(cmbx1.Text) End Sub
Private Sub UserForm_Initialize() Dim layerColl As AcadLayers Dim objlayer As AcadLayer
'fill combobox Set layerColl = ThisDrawing.Layers For Each objlayer In layerColl cmbx1.AddItem objlayer.Name Next End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Dim objlayer As AcadLayer
For Each objlayer In ThisDrawing.Layers objlayer.Lock = False Next End Sub

 

Valued Contributor
lanieuwe
Posts: 57
Registered: ‎10-26-2011
Message 2 of 2 (154 Views)

Re: Why does the locked layers not fading with vba?

01-04-2013 12:21 PM in reply to: lanieuwe

Nobody?

Normaly you can fading layers to lock them and set laylockfadectl for example to 80.

 

I have this setting normaly on 80.

When I lock a layer in the layermanager, this layer will be fade. 

 

When I lock a layer with vba code it doesn't fade?

 

Why is that ??.

 

please see my code.

 

gr laszlo

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.