hI thanks for the help you gave me.
Anyway, am still struggling to make it work in my application
Could you or anyone help me plot coordinates (XYZ) of points by just clicking a button in a vb.net application, and save points in a dxf or .dwg file, without necessarily opening autocad?
thanks.
QUOTE(nvalwaikar @ 26 Nov, 2006 - 10:26 PM)

If i am Creating a VB6.0 standard exe than i have to connect to autocad using the below code
Public acadApp As AcadApplication
Private Sub Form_Load()
frmStatus.Show
If ConnectToAutoCad = False Then
MsgBox "Unable to Connect to Autocad", vbCritical
End
End If
Public Sub ConnecttoAutocad ()
On Local Error Resume Next
Set acadApp = Nothing
''' Try to Connect to AutoCad2004
If acadApp Is Nothing Then
Set acadApp = GetObject(, "AutoCAD.Application.16")
If Err Then
Err.Clear
Set acadApp = CreateObject("AutoCAD.Application.16")
End If
End If
end Sub
the above code works fine as long as i am working on single autocad session and in a single active dwg
but if there are multiple autocad sessions running then it fails to connect to the autocad session that i want....
an alternative i was thinking of was to create a activeX dll wrapper which would be called from within the autocad
For eg. like this
1) (setq acd (vlax-get-acad-object)) ;; Get Acad Object
2) (setq srv (vlax-invoke acd "getinterfaceobject" "MyCadDll.MyTestProject")) ;; Initialize My Wrapper Dll
3) (setq ret (vlax-invoke srv "ChangeAllTextColorToRed" )) ;; Call my Function Present in the Dll
In this dll there is a Public function called 'ChangeAllTextColorToRed' which when invoked
from Visual-Lisp within autocad as shown in Step3 the all the text color present in the dwg should be changed to Red.
If this function was to be done in standard exe it would have been like this...
Public Function ChangeAllTextColorToRed()
Dim Ent As AcadEntity
For Each Ent In acadApp.ActiveDocument.ModelSpace
Ent.TrueColor = vbRed
Next Ent
End Function
this function works in standard exe coz in form load i have created the AcadApp object
which is an instance of current acad application, i want to create the same function in a activeX dll...