Message 1 of 1
Run Publish Command from VB net
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Have have written a program in VB.net to create and modify the Publish DSD file outside of autocad by just editing or creating the DSD file as a text file. Now i want to have my program click a button to launch autocad do the publish command and using the DSD file i created or modified. I have been able to open an instance of cad change the filedia to 0 then then it runs the publish command changes the filedia back to 1. but can't figure out how to close the instance of cad and how to make it wait until the publish is finished before it closes.
Any help would be appreciated.
Imports Autodesk.AutoCAD.Interop.AcadDocumentClass
Imports Autodesk.AutoCAD.Interop.Common
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim vAcadApp As Autodesk.AutoCAD.Interop.AcadApplication
Dim vAcadDoc As Autodesk.AutoCAD.Interop.AcadDocument
vAcadApp = New Autodesk.AutoCAD.Interop.AcadApplication With {
.Visible = True,
.WindowState = AcWindowState.acMax
}
'vAcadApp.WindowState = AcWindowState.acMin
'vAcadDoc = vAcadApp.Documents.Open("D:\Projects\FlowerBed.dwg", True)
vAcadDoc = vAcadApp.ActiveDocument
vAcadDoc.SendCommand("filedia 0" & Chr(13))
'vAcadDoc.SendCommand("-publish " & TextBox1.Text & Chr(13))
vAcadDoc.SendCommand("filedia 1" & Chr(13))
End Sub
End Class