I had a Acad btach automation app used the approach pointed out by Colin
French. The other approach is to used one of some of the User Variables
defined in ACD as System Variable.
Here is psuedo code:
In your VB6/VB.NET stand-alone app:
'Loop through drawings in a list/foder
For i=0 To UBound(FileList)
'Open Drawing
Set Dwg=acadApp.Documents.Open(FileList(i))
'Set User Variable in the drawing so VBA code in macro can read the
input
Dwg.SetVariable("USERS1","MyStringValue")
Dwg.SetVaraible("USERR1",0.00)
'Call VBA MACRO
acadApp.RunMacro "MyMacro"
Dwg.Close False 'or True
Next
In your VBA Macro
Sub MyMacro()
''Ge input from external app
Dim strInput As String
Dim dblInput as Double
strInput=ThisDrawing.GetVariable("USERS1")
dblInput=ThisDrawing.GetVariable("USERR1")
'Validate input
If MyValidateLogic(strInput, dblInput) Then
'If the inputs are valid, do whatever planned
ProcessTheDrawing strInput, dobInput
Else
''If the input is bad, you can write mesaage to a log file
''Or use the same approach to pass error information back to
external app
End If
End Sub
Private Sub ProcessTheDrawing(input as String, input2 As Double)
......
End Sub
Again, I'd try to avoid Acad automation if possible. Even for batch
processing, run inside Acad with LISP,VBA is a lot more faster, and easier
to debug.
The code Danielm showed to you is for Acad ObjectARX .NET API (which is
mainly the topic of this NG), and it run inside Acad. If you want to build
better user interfaces than VBA can do, then you may want to explore
ObjectARX .NET API. Be warned: it is a lot more difficult to learn than VBA
(mainly due to lack of documentation, because Autodesk is so busy to push
its new version yearly, that not bothering to provider documentation any
more), and it is not for stand-alone application.
wrote in message news:5642289@discussion.autodesk.com...
Hi Norman,
So I managed to run the VBA macro from within my stand-alone application in
VB.NET using moAcad.RunMacro("test.dvb!HideAllObjects").
Now how can I pass information from my Application to ACAD and opposite. For
example, how do I pass a TextInput value to a macro inside ACAD.
Thanks ...