AnsweredAssumed Answered

Increasing Ambient Light Value

Question asked by Chris Angevine on Sep 14, 2016
Latest reply on Sep 16, 2016 by Chris Angevine

Where I work, the projectors in conference rooms don't show our SolidWorks assemblies very well.  The brightness just isn't there.  If I turn it up on the projector for SolidWorks, all of the other applications are washed out.  One of the people here wrote a macro that will increase the ambient light in the assembly just for when we are in a conference room.  It works great.  The only problem is that when you change the assembly configuration, the ambient light goes back to it's original setting.  The SetLightSourcePropertyValuesVB command doesn't seem to have an option for configurations.  Although if you do it manually, there is.  The macro is below.

 

Any ideas on what else I can do?

 

Thanks, Chris

 

Dim swApp As Object

Dim swModel As ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = _
Application.SldWorks

Set swModel = swApp.ActiveDoc
Dim LightProps As Variant
Dim AmLightNum As Integer
Dim AmValue As Double
Dim Name As String
Dim i As Integer
Dim pos As Integer
If Not swModel Is Nothing Then
    AmLightNum = swModel.GetLightSourceCount
    For i = 0 To AmLightNum - 1
        LightProps = swModel.LightSourcePropertyValues(i)
        Name = swModel.GetLightSourceName(i)
        pos = InStr(Name, "Ambient")
        If pos > 0 Then
            AmValue = LightProps(15)
            If AmValue < 0.3 Then boolstatus = swModel.SetLightSourcePropertyValuesVB(Name, 1, 1, 16777215, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.75, 0, 0, False)
            If AmValue > 0.29 Then boolstatus = swModel.SetLightSourcePropertyValuesVB(Name, 1, 1, 16777215, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.29, 0, 0, False)
        End If
    Next i
End If

swModel.ForceRebuild3 (True)

End Sub

Outcomes