y2kmvr
Aerospace
- Oct 17, 2004
- 14
Hi Everyone,
I am trying to export DXF file into STEP through VB Automation. The function/method for export does not seem to work. It is not giving any error. Please see attached code. Thanks for your help. The export function is called at the end of the program.
Private Sub Command1_Click()
Dim ACADApp As AcadApplication
'Check if the Application AutoCAD is running.
'if it is then, link to this
Set ACADApp = GetObject("", "AutoCAD.Application.16")
'Set the AutoCAD visibility to False (batch execution)
ACADApp.Visible = False
On Error Resume Next
If Err Then
Err.Clear
'If AutoCAD is not running,launch it and attach it to this process
Set ACADApp = CreateObject("AutoCAD.Application.16")
'Set the AutoCAD visibility to False (batch execution)
ACADApp.Visible = True
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
' Disply which version of AutoCAD that we are running
MsgBox "Now running " + ACADApp.Name + _
" version " + ACADApp.Version
'Open the 3D DXF file into AutoCAD
ACADApp.Application.Documents.Open ("C:\output1\Robin6h.dxf")
'Display the Active Document name
MsgBox "Active Document Name:" & ACADApp.Application.ActiveDocument.Name
'Display the full name of Active Document
MsgBox "Active Document FullName:" & ACADApp.Application.ActiveDocument.FullName
' Define the name for the exported file
Dim exportFile As String
exportFile = "C:\output\reddy1" ' Adjust path to match your system
' Create an empty selection set
Dim sset1 As AcadSelectionSet
Set sset1 = ACADApp.ActiveDocument.SelectionSets.Add("TEST1")
'Display the document name that we are going nto export into STEP
MsgBox "activedocument:" & ACADApp.ActiveDocument.FullName
' Export the current drawing to the file specified above.
ACADApp.ActiveDocument.Export exportFile, "STP", sset1
'Delete the set
sset1.Delete
'end of Export
'Quit the Application
ACADApp.Quit
End Sub
Thanks
y2kmvr
I am trying to export DXF file into STEP through VB Automation. The function/method for export does not seem to work. It is not giving any error. Please see attached code. Thanks for your help. The export function is called at the end of the program.
Private Sub Command1_Click()
Dim ACADApp As AcadApplication
'Check if the Application AutoCAD is running.
'if it is then, link to this
Set ACADApp = GetObject("", "AutoCAD.Application.16")
'Set the AutoCAD visibility to False (batch execution)
ACADApp.Visible = False
On Error Resume Next
If Err Then
Err.Clear
'If AutoCAD is not running,launch it and attach it to this process
Set ACADApp = CreateObject("AutoCAD.Application.16")
'Set the AutoCAD visibility to False (batch execution)
ACADApp.Visible = True
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
' Disply which version of AutoCAD that we are running
MsgBox "Now running " + ACADApp.Name + _
" version " + ACADApp.Version
'Open the 3D DXF file into AutoCAD
ACADApp.Application.Documents.Open ("C:\output1\Robin6h.dxf")
'Display the Active Document name
MsgBox "Active Document Name:" & ACADApp.Application.ActiveDocument.Name
'Display the full name of Active Document
MsgBox "Active Document FullName:" & ACADApp.Application.ActiveDocument.FullName
' Define the name for the exported file
Dim exportFile As String
exportFile = "C:\output\reddy1" ' Adjust path to match your system
' Create an empty selection set
Dim sset1 As AcadSelectionSet
Set sset1 = ACADApp.ActiveDocument.SelectionSets.Add("TEST1")
'Display the document name that we are going nto export into STEP
MsgBox "activedocument:" & ACADApp.ActiveDocument.FullName
' Export the current drawing to the file specified above.
ACADApp.ActiveDocument.Export exportFile, "STP", sset1
'Delete the set
sset1.Delete
'end of Export
'Quit the Application
ACADApp.Quit
End Sub
Thanks
y2kmvr