Message 1 of 4
CMDECHO NOMUTT not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I'm having a problem with CMDECHO and NOMUTT. Have a program that loads or reloads a linetype; found on Dev Blogs. It uses the Send Command option, which obviously writes to the command line. I am getting, setting and restoring the CMDECHO and NOMUTT but it is still writing to the command bar. How do I fully suppress this. I know it's due to the Send Command and that some things like purge cant be suppressed but if works with creating say a text style why not with loading/reloading a linetype?
Called from Form...
Private Sub btnInsert_Click(sender As Object, e As EventArgs) Handles btnInsert.Click
Try
Dim selectedLineType As String = lstSelectLinetype.SelectedItem.Filename
Dim pathHelper As New DetailPathHelper(selectedLineType)
selectedLineTypeName = pathHelper.LinetypeName
Dim linetypeFilePath = _clientLinetypeService.FindLinetypeFileForClient(cmbSelectLineTypeFile.Text)
_autocadSystemVariableServices.StoreSystemVariables()
_autocadSystemVariableServices.SetSystemVariables()
_autocadService.LoadLinetype(selectedLineTypeName, linetypeFilePath)
_autocadSystemVariableServices.RestoreSystemVariables()
Catch ex As Exception
_autocadSystemVariableServices.RestoreSystemVariables()
End Try
End Sub
Sub Called...
Public Class AutocadService
Implements IAutocadService
Public Sub LoadLinetype(ByVal selectedLineTypeName As String, ByVal lineTypeFile As String) Implements IAutocadService.LoadLinetype
Dim acDoc As Document = AutocadActiveDocument.Document
Dim acCurDb As Database = AutocadActiveDocument.Database
Dim ltReload As Boolean = False
Try
Using acDocLock As DocumentLock = acDoc.LockDocument
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
Dim acLineTypTbl As LinetypeTable
acLineTypTbl = acTrans.GetObject(acCurDb.LinetypeTableId, OpenMode.ForRead)
If acLineTypTbl.Has(selectedLineTypeName) = True Then
ltReload = True
End If
acTrans.Commit()
End Using
End Using
Dim acAppObject As Object = Application.AcadApplication
Dim acDocObject As Object = acAppObject.GetType().InvokeMember("ActiveDocument", System.Reflection.BindingFlags.GetProperty, Nothing, acAppObject, Nothing)
Dim sendCommandDataArray As Object() = New Object(0) {}
If ltReload Then
sendCommandDataArray(0) = "-linetype Load" & vbLf & selectedLineTypeName & vbLf & lineTypeFile & vbLf & "Yes" & vbLf & " "
Else
sendCommandDataArray(0) = "-linetype Load" & vbLf & selectedLineTypeName & vbLf & lineTypeFile & vbLf & " "
End If
acDocObject.GetType().InvokeMember("SendCommand", System.Reflection.BindingFlags.InvokeMethod, Nothing, acDocObject, sendCommandDataArray)
sendCommandDataArray(0) = "regenall" & vbLf
acDocObject.GetType().InvokeMember("SendCommand", System.Reflection.BindingFlags.InvokeMethod, Nothing, acDocObject, sendCommandDataArray)
Catch ex As Exception
End Try
End Sub
System Variable Class...
Public Class AutocadSystemVariableServices
Implements IAutocadSystemVariableServices
Dim restoreOldFiledia As Integer
Dim restoreOldCmdecho As Integer
Dim restoreOldNomutt As Integer
Public Sub StoreSystemVariables() Implements IAutocadSystemVariableServices.StoreSystemVariables
restoreOldFiledia = Convert.ToInt16(Application.GetSystemVariable("FILEDIA"))
restoreOldCmdecho = Convert.ToInt16(Application.GetSystemVariable("CMDECHO"))
restoreOldCmdecho = Convert.ToInt16(Application.GetSystemVariable("NOMUTT"))
End Sub
Public Sub SetSystemVariables() Implements IAutocadSystemVariableServices.SetSystemVariables
Application.SetSystemVariable("FILEDIA", 0)
Application.SetSystemVariable("CMDECHO", 0)
Application.SetSystemVariable("NOMUTT", 0)
End Sub
Public Sub RestoreSystemVariables() Implements IAutocadSystemVariableServices.RestoreSystemVariables
Application.SetSystemVariable("FILEDIA", restoreOldFiledia)
Application.SetSystemVariable("CMDECHO", restoreOldCmdecho)
Application.SetSystemVariable("NOMUTT", restoreOldNomutt)
End Sub
End Class