VB layer question
VB layer question
(OP)
I am able to turn layers on and off in VB. My question is that I would like to use a checkbox in VB 6 to control the layer. I havn't figured out how to get the checkbox to show a check if the layer is on when the .exe is run. Can anyone help?






RE: VB layer question
The object layer have the following properties:
Layer.Color
Layer.Description
Layer.Name
Layer.Style
Layer.Visible
Layer.Width
and one Method Layer.GetID.
Turn Layer.Visible On and Off to make it happen.
Layer.Visible = False
Remember that you need to access the object Layer from the LayerMgr wich it is a collection of Layers.
RE: VB layer question
Dim swApp As Object
Dim pDrawing As Object
Dim pLayerMgr As Object
Dim pLayer As Object
Sub main()
Set swApp = Application.SldWorks
Set pDrawing = swApp.ActiveDoc
Set pLayerMgr = pDrawing.GetLayerManager
Set pLayer = pLayerMgr.GetLayer("YOURLAYER")
if chkbox.value = 1 then pLayer.Visible = true
if chkbox.value = 0 then pLayer.visible = false
End Sub
RE: VB layer question
Translation:
Check all the layers when the form loads, then adjust checkboxes accordingly. Use the checkbox change events to trigger instantaneous layer toggling.
http://www.EsoxRepublic.com