SendCommand System.Runtime.InteropServices.COMException
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sub Main()
Dim acAppComObj AsAcadApplication
Dim strProgId AsString = "AutoCAD.Application.19"
OnErrorResumeNext
'' Get a running instance of AutoCAD
acAppComObj = GetObject(, strProgId)
'' An error occurs if no instance is running
If Err.Number > 0 Then
Err.Clear()
'' Create a new instance of AutoCAD
acAppComObj = CreateObject(strProgId)
'' Check to see if an instance of AutoCAD was created
If Err.Number > 0 Then
Err.Clear()
'' If an instance of AutoCAD is not created then message and exit
MsgBox("Instance of 'AutoCAD.Application' could not be created.")
Return
EndIf
EndIf
'' Display the application and return the name and version
acAppComObj.Visible =True
'' Get the active document
Dim acDocComObj AsAcadDocument
acDocComObj = acAppComObj.ActiveDocument
'' Optionally, load your assembly and start your command or if your assembly is demandloaded, simply start the command of your in-process assembly.
acDocComObj.SendCommand("(command " & Chr(34) & "NETLOAD" & Chr(34) & " " & Chr(34) & "H://x64/Debug/octr_dwg_cmd.dll" & Chr(34) & ") ")
acDocComObj.SendCommand("(xxx " & Chr(34) & "ss" & Chr(34) & ") ")
EndSub
The code execute à LISP function from octr_dwg_cmd.dll and produce the following:
(xxx "ss") System.Runtime.InteropServices.COMException (0x80200033): Erreur de fichier
à System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
à Autodesk.AutoCAD.ApplicationServices.DocumentCollectionExtension.Add(DocumentCollection docCol, String templateFileName)
à octr_dwg_cmd.Module1.octr_dwg(String FichierZip) dans H:\developpement\octr_dwg_cmd\octr_dwg_cmd\Module1.vb:ligne 12
à octr_dwg_cmd.octr_dwg_cmd.MyCommands.MyLispFunction(ResultBuffer args) dans H:\developpement\octr_dwg_cmd\octr_dwg_cmd\myCommands.vb:ligne 76
à Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
à Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
à Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
à Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.InvokeLisp(); erreur: Demande ADS erronée
When I input at the command line of AutoCAD the same (xxx "ss"), the result is OK. The problem occurs whit the SendCommand of my EXE program.
Any help will be appreciated
Regards,