Wednesday, September 19, 2007

Toggle AutoCAD Application Visibility

We can do a lot AutoCAD related programming outside AutoCAD using Windows Script Host. Some of the areas where windows scripting is useful are network management, windows registry manipulation, file or folder acces etc. Here is a sample VBScript code to toggle AutoCAD application visibility state.


On Error Resume Next
Set ObjACAD = GetObject(, "AutoCAD.Application")
If Err.Number <> 0 Then Err.Clear
MsgBox "AutoCAD is not currently running...!!", vbExclamation
Else
If ObjACAD.Visible = True Then
ObjACAD.Visible = False
Else
ObjACAD.Visible = True
End If
End If
Set ObjACAD = Nothing

Just copy the code and paste it inside notepad and save it with a vbs extension. Run the the file while AutoCAD is open. It will toggle the application display everytime you run it. Now you can leave your PC with peace of mind that nobody would interfere with your opened drawings.

1 comment:

intercad said...

You will probably have to use Solidworks to convert the SLDDRW files into something else first, such as DWG for use in a more easily obtained application such as AutoCAD. . . You could even use DWG files in Google's free SketchUp if the changes you need to make are basic.

Buy Solidworks