VB6 and AutoCad (dsi ..do reply)
VB6 and AutoCad (dsi ..do reply)
(OP)
I asked about generating visual effects in other programming languages through autocad, which dsi mentioned that VB6 can be of help. I have actually made a program of Stiffness Matrix in Fortran , but am not satisfied with the presentation, im looking forward to make it in VB , if any one can help me in mentioning the sources from where i can get hints about working in Autocad and VB6 together.





RE: VB6 and AutoCad (dsi ..do reply)
There is a ton of information in the AutoCAD help files on VBA. Go to Help > Contents and see the chapter on ActiveX and VBA.
There is also a good book that covers this topic pretty well. AutoCAD 2000 VBA by Joe Sutphin. I found it for less than $30.
I am still unsure of excatly what you want to accomplish. If you want, you can send me some screen captures of your existing Fortran results. If they will help, I can link them into this thread so others can view them as well.
Here is a quick sample on how to use VB6 to automate AutoCAD
Sub Test()
Dim CadApp As AcadApplication
Dim CadDwg As AcadDocument
Dim textObj As AcadText
Dim pt2(0 To 2) As Double
'<><><><><><><><><><><><><><><><><><><><><>
' Connect to AutoCAD
'<><><><><><><><><><><><><><><><><><><><><>
On Error Resume Next
Set CadApp = GetObject(, "AutoCAD.Application")
If Err.Number <> 0 Then 'Not Running
Set CadApp = CreateObject("AutoCAD.Application")
Err.Clear
End If
On Error GoTo ErrHndlr
'<><><><><><><><><><><><><><><><><><><><><>
' Open the Drawing Template
'<><><><><><><><><><><><><><><><><><><><><>
sDwgTemplate = "C:\Temp\A5-Template.dwg"
If Dir(sDwgTemplate) <> "" Then
CadApp.Documents.Open sDwgTemplate
Else
MsgBox "File " & sDwgTemplate & " does not exist."
End If
'<><><><><><><><><><><><><><><><><><><><><>
' Update Drawing
'<><><><><><><><><><><><><><><><><><><><><>
Set CadDwg = CadApp.ActiveDocument
pt2(x) = 8.6422: pt2(y) = 7.1831: pt2(z) = 0
'Insert 1/8" text at pt 2
Set textObj = CadDwg.ModelSpace.AddText("Test", pt2, 0.125)
CadApp.ZoomExtents
' CadDwg.SaveAs ("FullPath and New File Name Here")
CleanUp:
Set CadDwg = Nothing
Set CadApp = Nothing
Set textObj = Nothing
Exit Sub
ErrHndlr:
CadApp.Visible = False
MsgBox "Error in Test()" & vbCrLf & vbCrLf & _
"Error No. " & Err.Number & vbCrLf & _
"Description: " & Err.Description
Err.Clear
CadApp.Visible = True
End Sub
I hope that works! I quickly scammed a couple of lines from one of my applications.
As you can see, it is not too difficult. Hope this helps!
RE: VB6 and AutoCad (dsi ..do reply)
Oops! Left out the e-mail address.
DimensionalSolutions@Core.com