Run Publish Command from VB net

Run Publish Command from VB net

skG764U
Explorer Explorer
511 Views
0 Replies
Message 1 of 1

Run Publish Command from VB net

skG764U
Explorer
Explorer

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
0 Likes
512 Views
0 Replies
Replies (0)