Background Information
It is often necessary to make major changes in the settings in VBA levels. For example, running in batch mode.
Many of the potential level attributes such as color, line width, line style, etc. are designed as direct properties available in the VBA object model settings, while others you can change as a VBA wrapper from the MDL add functions.
Transparency, which can be changed as a property in the Layer Manager, can be given a value between 0 and 100.
Steps
To change the transparency settings of levels, a VBA wrapper function is needed. The V8 "MDL Function Reference" states the following:
VBA Wrapper Declaration
Declare Function mdlLevel_setTransparency Lib "stdmdlbltin.dll" (ByVal modelRefln As Long, ByVal levelldln As Long, ByVal transparencyIn As Double) As Long
If you want to apply this declaration into a VBA routine, it might look like the following:
Declare Function mdlLevel_getTransparency Lib "stdmdlbltin.dll" (ByRef transparencyOut As Double, ByVal modelRefIn As Long, ByVal levelIdIn As Long) As Long Declare Function mdlLevel_setTransparency Lib "stdmdlbltin.dll" (ByVal modelRefIn As Long, ByVal levelIdIn As Long, ByVal transparencyIn As Double) As Long Sub levelTransparency() Dim oLv As Level For Each oLv In ActiveDesignFile.Levels If Not oLv.IsFromLevelLibrary Then mdlLevel_setTransparency ActiveModelReference.MdlModelRefP, oLv.ID, 0.4 ' Transparency between 0 and 1 End If Next ActiveDesignFile.Levels.Rewrite End Sub
The new transparency value must be set as a double value in the range between 0.0 and 1.0 corresponding to the percentage of transparency you want (0% to 100%).
See Also
Changing the presentation order of Layers