• Viernes 3 de Mayo de 2024, 07:29

Autor Tema:  Urgente!! Visual Basic 6 + Autocad  (Leído 1562 veces)

Tagasa

  • Miembro activo
  • **
  • Mensajes: 66
    • Ver Perfil
Urgente!! Visual Basic 6 + Autocad
« en: Martes 21 de Febrero de 2006, 11:42 »
0
Buenos dias!

Tengo una aplicación que guarda planos .dwg. Estos planos tienen un .tif incrustado, y lo que la aplicación tiene que hacer es detectar que tiene ese .tif incrustado, cogerme el nombre y copiar a otra carpeta el -dwg y el .tif. El codigo que tengo es el siguiente, donde ejecuta el Autocad y en teoría tendría que coger el .tif. No se donde está el fallo o si falta algo. Os agradecería mucho si me ayudarais, es muy importante.

    Dim orden As String
    Dim objAcad As Object
    Dim objDoc As Object
    Dim DwgName As String
    Dim extApp As ActiveXExtension
    Dim entType As Integer
    Dim entry As Object
    Dim raster As String
    Dim Autocad_04, prueba As String
    Dim retval

    On Error Resume Next
   
    Set objAcad = GetObject(, "AutoCAD.Application")


If Err Then
   Err.Clear

    retval = Shell("C:\Archivos de programa\Autodesk\Acadm 2004 DX\acad.exe")
             
    If Err Then
        MsgBox Err.Description
        Screen.MousePointer = vbDefault
        Exit Sub
    Else
           
        LinkApp lblHead, "AutoCAD.2004", "System"
        Dim strcmd As String
        strcmd = "_quit" + vbLf
        lblHead.LinkExecute strcmd
     
       Set objAcad = CreateObject("AutoCAD.Application")
     
        objAcad.Visible = True
        Set objDoc = objAcad.ActiveDocument
           
        DwgName = AnadirRuta
       
        If objDoc.FullName <> DwgName Then
            objDoc.Open DwgName
        End If

        Set extApp = objAcad.GetInterfaceObject("ActiveXExtension.Application.1")
        For Each entry In objDoc.ModelSpace
            entType = entry.EntityType
            If entType = 26 Then
                raster = extApp.GetRasterImageFile(entry)
                fichero_raster = raster
            End If
        Next
        If raster <> "" Then
            Dim fichero As String
            Dim sextx As String
           
            sextx = Right(raster, 3)
            fichero = NumeroPlano + "_" + QueRevision + "." + sextx
           
            Dim strcmd2 As String
                 strcmd = "-image" + vbLf + "c" + vbLf + "*" + vbLf + fichero + vbLf
            strcmd2 = "filedia" + vbLf + "0" + vbLf + "._save" + vbLf + "" + vbLf + "_y" + vbLf + "filedia" + vbLf + "1" + vbLf
       
            LinkApp lblHead, "AutoCAD.2004", "System"
             
            lblHead.LinkExecute strcmd
            lblHead.LinkExecute strcmd2
        End If
        Screen.MousePointer = vbDefault
   
        objAcad.Quit
        objAcad.nothing
    End If
   
End If

Muchas gracias y un saludo.