shamsam1 Posted December 16, 2008 Posted December 16, 2008 i have autocad2007 and autocad LT 2006 in my system i want to open dwg files in autccad Lt 2006 using vb.6 code. i want to modify the above code and open dwg drawings in Lt else looking for suitable vb.6 code Dim DwgName As String On Error Resume Next Set acadApp = GetObject(, "AutoCAD.Application") If Err Then Set acadApp = CreateObject("AutoCAD .Application") Err.Clear End If ' If Right(App.Path, 1) = "\" Then ' DwgName = "C:\13027167-GX2.dwg" ' Else ' DwgName = "C:\13027167-GX2.dwg" ' End If Set acadDoc = acadApp.ActiveDocument If acadDoc.FullName <> DwgName Then acadDoc.Open DwgName End If Dim str As String, str1 As String str1 = "_-insert" & vbLf & """" & "C:\14001120-AA8232-AC8232-AZ665.dwg" & """" & vbLf & "0,0,0" & vbLf & vbLf & vbLf & vbLf & "z" & vbLf & "a" & vbLf 'str = "dwin" & vbLf acadDoc.SendCommand str1 ' acadDoc.SendCommand str acadApp.Visible = True Quote
borgunit Posted December 16, 2008 Posted December 16, 2008 I do not believe the LT version can be accessed with VB in it's present state. Quote
Raggi_Thor Posted December 16, 2008 Posted December 16, 2008 That's right. You have no COM interface in LT, so you have nothing like Set acadLTApp = CreateObject("AutoCADLT.Application") You can get lisp in LT with LT-Extender. You can "run" a dwg file in Windows with VB, this will open it in LT if you have the file association. Quote
shamsam1 Posted December 16, 2008 Author Posted December 16, 2008 i do agree but if u have only LT or autocad 2007 in system then this shell command can be used to open the drawing but i want to pass some values in command line which i dotn know how to do it in lt Option Explicit Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Private Const SW_HIDE As Long = 0 Private Const SW_SHOWNORMAL As Long = 1 Private Const SW_SHOWMAXIMIZED As Long = 3 Private Const SW_SHOWMINIMIZED As Long = 2 Private Sub Command1_Click() ShellExecute Me.hwnd, "open", "C:\Users\Public\Test1.dwg", vbNullString, "C:\", SW_SHOWNORMAL End Sub Quote
shamsam1 Posted December 16, 2008 Author Posted December 16, 2008 where can i get LT-Extender. is it free version? Quote
Raggi_Thor Posted December 16, 2008 Posted December 16, 2008 http://www.lt-extender.com I used to sell this add on in Norway. Now I sell Bricscad as an alternative to Acad and LT:) Quote
shamsam1 Posted December 17, 2008 Author Posted December 17, 2008 hello Ragnar Thor i have downloaded briscad trail version ple help me out with vb.6 code to open and also to inset dwg drawings regards sam Quote
Raggi_Thor Posted December 17, 2008 Posted December 17, 2008 It is almost the same as for AUtoCAD. For example: Dim bcad As AcadApplication Dim I As Integer On Error Resume Next Retry: 'In case Bricscad is closing down Set bcad = GetObject("", "BricscadApp.AcadApplication") If Err = -2147023179 Then I = I + 1 Err.Clear If I > 1000 Then Exit Function GoTo Retry Set bcad = CreateObject("BricscadApp.AcadApplication") End If bcad.Visible = True Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.