Attribute VB_Name = "Module1"
Public Function SetToLoad()
Dim filenum As Integer
Dim strLoad, strAppPath, strIcadPath, strLmanage As String
Dim fso As New FileSystemObject
Dim fsoFile As File
Dim blnFile As Boolean
Call GetAppIcad
strIcadPath = IntelliCAD.Application.Path
strAppPath = App.Path
strAppPath2 = Replace(strAppPath, "\", "\\")
'Writes the lmanage.lsp file
filenum = FreeFile
Open strAppPath & "\lmanage.lsp" For Output As filenum
Print #filenum, "(DEFUN c:lmanage ()"
Print #filenum, "    (SETVAR ""cmdecho"" 0)"
Print #filenum, "    (STARTAPP """ & strAppPath2 & "\\lmanage.exe"")"
Print #filenum, "    (princ)"
Print #filenum, ") ;_ end of DEFUN"
Print #filenum, "(prompt ""\nLayer Manager 1.0 Loaded. Type lmanage to run."")(princ)"
Close #filenum
'Writes to the Icad.lsp file
strLoad = "(load """ & strAppPath2 & "\\lmanage.lsp"")"
filenum = FreeFile
Open strIcadPath & "\Icad.lsp" For Append As filenum
Print #filenum, ""
Print #filenum, ";;; The following lines were added for loading the Layer Manager automatically"
Print #filenum, strLoad
Print #filenum, "(princ)"
Print #filenum, ";;; End of Layer Manager Autoload"
Close #filenum
MsgBox "Files Updated successfully! Restart IntelliCAD and type lmanage to run."
End Function
Public Function GetAppIcad()
'Links to the Application or Launches a new one
On Error Resume Next
Set IcadApp = GetObject(, "icad.application")
If Err <> 0 Then
Set IcadApp = CreateObject("icad.application")
End If
IcadApp.Visible = True
'Links to the current document or creates a new document
On Error Resume Next
Set ThisDrawing = IcadApp.ActiveDocument
If Err <> 0 Then
Set ThisDrawing = IcadApp.Documents.Add
End If
End Function
