I am wading my way through this as the core console sounds like exactly what I need. I need the give the ability for my users to process mass amounts of drawings from within my .NET app. I am having some issues getting it working though.
Basically I followed some of Augusto's code to launch the scr file which then in turn would load the stripped down .NET dll that will process. I have simplified in the below example to just basically get it working, then will add the actual code. I am using 2015 AutoCAD.
Contents of my main .NET dll to launch the core console:
Private Sub Button7_Click_1(sender As Object, e As EventArgs) Handles Button7.Click
Dim process As New Process()
process.StartInfo.UseShellExecute = False
process.StartInfo.RedirectStandardOutput = True
process.StartInfo.CreateNoWindow = True
Dim scriptFile As String
Dim fileName As String
scriptFile = "C:\SYSTEM_NO\core_console.scr"
fileName = "C:\PD612-A-JEFF-9009-1.DWG"
process.StartInfo.FileName = "C:\Program Files\Autodesk\AutoCAD 2015\accoreconsole.exe"
Dim param As String
param = " /s " & scriptFile
param = param & " /i " & fileName
process.StartInfo.Arguments = param
Try
Using (process)
process.Start()
End Using
Catch
MsgBox(Err.Description)
End Try
End Sub
So, the contents of the scr file are as follows. It just loads the dll, the executes a function:
(command "_.Netload" "C:\\system_no\\core_console.dll")
Test1
And here is the example of the dll that is called:
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Imports System.IO
Public Class Class1
Public Sub Test1()
MsgBox("It ran")
End Sub
End Class
This is the result of what I get when the core console window comes up:
Regenerating model.
Press ENTER to continue:
Command:
Command:
Command:
Command: (command "_.Netload" "C:\\system_no\\core_console.dll")
_.Netload Assembly file name: C:\system_no\core_console.dll
ommand: nil
Command: Test1
Unknown command "TEST1". Press F1 for help.
Command: _quit
Command:
C:\Program Files>
Even when I try to run the script and dll directly through the core console, I get the same error:
C:\Program Files\Autodesk\AutoCAD 2015\accoreconsole.exe /i C:\PD612-A-JEFF-9009-1.DWG /s C:\SYSTEM_NO\core_console.scr /l en-US