Visual Basic problem.

Jun 25, 2017 0 Replies

When I installed AutoCAD 2013, I included the Visual Basic option. The code shown below works in previous versions of AutoCAD, but not in Auto CAD 2013. Can somebody help me to get it working. I am not a VBA writer. I am a LISP writer. I got help with this like a decade ago. This helps m e be able to change the background back and forth quickly so I can see the darker linework more easily. I can work without it, but it's a strain on m y eyes.



I use the following function to run the code for Module1:



(DEFUN C:disp NIL (command "vbarun" "display.dvb!module1.chgdisp")(PRINC))



The following is Display.dvb - Module1 (Code)



Option Explicit Public Sub chgdisp()



Dim ACADdPref As AcadPreferences Set ACADdPref = ThisDrawing.Application.Preferences Dim curcolor As OLE_COLOR Dim curlayout As String curlayout = ThisDrawing.ActiveLayout.Name



If curlayout = "Model" Then curcolor = ACADdPref.Display.GraphicsWinModelBackgrndColor If curcolor = vbBlack Then ACADdPref.Display.GraphicsWinModelBackgrndColor = RGB(190, 19



0, 190) ACADdPref.Display.ModelCrosshairColor = RGB(0, 0, 0) Else ACADdPref.Display.GraphicsWinModelBackgrndColor = vbBlack ACADdPref.Display.ModelCrosshairColor = vbWhite End If Else curcolor = ACADdPref.Display.GraphicsWinLayoutBackgrndColor If curcolor = vbBlack Then ACADdPref.Display.GraphicsWinLayoutBackgrndColor = RGB(190, 1
90, 190) ACADdPref.Display.LayoutCrosshairColor = RGB(0, 0, 0) Else ACADdPref.Display.GraphicsWinLayoutBackgrndColor = vbBlack ACADdPref.Display.LayoutCrosshairColor = vbWhite End If End If End Sub

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required