Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB to set SolidWorks layers to visible 1

Status
Not open for further replies.

jh0401

Computer
Joined
Apr 8, 2002
Messages
32
Location
US
Does anyone have a good example for turning SolidWorks layers on and off with Visual Basic?

Thanks

Josh
 
You should probably post this in the SolidWorks forum. There are plenty of API discussions there. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
I don't have an example, but it should be accessible with the Layer.Visible property. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Here is a sample that turns off a layer called DIM:
Code:
Option Explicit

Sub TurnOffLayer()
    Dim swApp As Object
    Dim Part As Object
    Dim swLayerMgr As Object
    Dim swLayer As Object
    
    Set swApp = CreateObject("SldWorks.Application")
    Set Part = swApp.ActiveDoc
    Set swLayerMgr = Part.GetLayerManager
    Set swLayer = swLayerMgr.GetLayer("DIM")
    swLayer.Visible = False

    Set swLayer = Nothing
    Set swLayerMgr = Nothing
    Set Part = Nothing
    Set swApp = Nothing
End Sub
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
dsi,
Thanks for you help.
joshh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top