Author Topic: Need help with VB.Net app  (Read 2547 times)

0 Members and 1 Guest are viewing this topic.

zmwp3214

  • Guest
Need help with VB.Net app
« on: September 09, 2008, 04:07:23 PM »
I have made the following program but am unable to get it to switch to the file that is opened and then finish running the etransmit command in the newly opened file rather then when i switch back to the orginial drawing, i assume it is in the active drawing settings but cant figure out how to get it to change to the new drawing.
Code: [Select]
Imports System.Runtime.InteropServices
Imports System.Runtime.InteropServices.Marshal
Imports System.Windows.Forms
Imports System.Windows
Imports System.Runtime
Imports System.Text
Imports System.Drawing
Imports System.Type

'AutoCad Name spaces
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.DatabaseServices.TransactionManager
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.ApplicationServices.Application
Imports Autodesk.AutoCAD
Imports Autodesk.AutoCAD.GraphicsInterface
Imports Autodesk.AutoCAD.Windows
Imports AcApp = Autodesk.AutoCAD.ApplicationServices.Application

'Civil 3d Related namespaces
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Imports Autodesk.AECC.Interop.Land
Imports Autodesk.AECC.Interop.UiLand




Namespace ExportDWG

    Public Class ExportDWG
        <CommandMethod("ExportDWG", CommandFlags.Modal Or CommandFlags.Session)> _
        Public Shared Sub ExportDWG()

            Dim Dwg As Document
            Dwg = DocumentManager.MdiActiveDocument
            '---------------------------------------------------------------------------------------
            'exports file with xrefs bound to autocad, this removes civil objects from file
            'and allows file to be opened in plain autocad and see civil objects.
            Dwg.SendStringToExecute("_AecExportToAutoCAD" & vbLf, False, False, False)
            '---------------------------------------------------------------------------------------

            'open exported file from above to run etransmit on
            Dwg.SendStringToExecute("_open" & vbLf, false, True, False)

            'etransmit newly opened drawing.
            Dwg.SendStringToExecute("_etransmit" & vbLf, True, False, False)

        End Sub

    End Class
End Namespace

Thanks for any help