Si ha utilizado símbolos personalizados en los modelos de visualización y desea actualizarlos con los símbolos modificados, puede abrir el modelo de visualización, generar el gráfico y utilizar MAPSYMBOLIMPORTEXPORT para importar los símbolos modificados. Para obtener más información, consulte Para importar símbolos.
Para importar símbolos en lote sin utilizar una interfaz de usuario
Como alternativa, puede completar automáticamente los pasos anteriores por medio de un script. En la línea de comando, cargue el script con el comando SCRIPT y espere hasta que haya finalizado. Si ejecuta varios scripts para diferentes modelos de visualización, asegúrese de que siempre empieza con un dibujo vacío antes de abrir el modelo de visualización. De lo contrario, guardará capas anteriores del dibujo precedente en el nuevo modelo de visualización.
El siguiente es un script de ejemplo. Puede guardarlo como un archivo con la extensión .scr.
CMDDIA 0 FILEDIA 0 _TBDMOPEN [path to your TBDM file] _TBGENERATEGRAPHIC _MAPSYMBOLIMPORTEXPORT _IMPORT [choose options that fit your needs] _TBDMSAVECuando termine de utilizar el script, establezca las variables CMDDIA y FILEDIA en su valor original, que suele ser 1.
Para ahorrar tiempo, puede importar los símbolos de varios modelos de visualización en una sola operación mediante un script VBA (Microsoft Visual Basic for Applications). El script siguiente es un ejemplo. Lo puede utilizar como plantilla; realice las modificaciones necesarias y, a continuación, guárdelo como un archivo .bas.
Attribute VB_Name = "ImportSymbolInto_IM_DM" Sub ImportSymbolIntoDisplayModel() Dim prototypeDWG, templateDWT As String Dim FileDia, CmdDia As Integer Dim displayModelArray(0 To 2) As String 'TODO: Adapt to the number of Display Models to update ' TODO - Adapt to your settings ' Define the path to the Display Models for updating the symbol(s) ' When adding or removing Display Models, please adapt also the size of displayModelArray ' and the loop over all Display Models displayModelArray(0) = "C:\TEST\DM1\DM1.tbdm" displayModelArray(1) = " C:\TEST\DM2\DM2.tbdm" displayModelArray(2) = " C:\TEST\DM3\DM3.tbdm" ' Attention !!! ' Only use the "Generic Graphic" - Application option: Reuse current drawings ' We need the same drawing for all operations ! ' TODO - Adapt to your settings ' Define where the symbol(s) should be imported from prototypeDWG = "C:\temp\symbol_modified.dwg " ' TODO - Adapt to your settings ' Define the template file to be used when open a new DWG templateDWT = "c:\temp\Template\map2d.dwt" Dim currentSDI As Integer currentSDI = ThisDrawing.GetVariable("SDI") If (currentSDI = 1) Then MsgBox "The functions works only with multiple drawings [SDI=0]" Exit Sub End If FileDia = ThisDrawing.GetVariable("FILEDIA") CmdDia = ThisDrawing.GetVariable("CMDDIA") ThisDrawing.SetVariable "FILEDIA", 0 ThisDrawing.SetVariable "CMDDIA", 0 ' Loop all Display Models For inti = 0 To 2 ' Open an empty drawing Application.Documents.Open (templateDWT) ' Open the Display Model ThisDrawing.SendCommand "_TBDMOPEN" & vbCr & displayModelArray(inti) & vbCr ThisDrawing.SendCommand "_TBGENERATEGRAPHIC" & vbCr ' Import the symbol and apply changes to the layers ThisDrawing.SendCommand "_MAPSYMBOLIMPORTEXPORT" & vbCr & "_IMPORT" & vbCr & prototypeDWG & vbCr & "_YES" & vbCr ' Save the changes of the layers to the Display Model ThisDrawing.SendCommand "_TBDMSAVE" & vbCr ' Do not save the drawing ThisDrawing.Close (False) Next ' Reset the system variables ThisDrawing.SetVariable "FILEDIA", FileDia ThisDrawing.SetVariable "CMDDIA", CmdDia End Sub
En el script de ejemplo, existe un módulo "ImportSymbolInto_IM_DM" con un subelemento "ImportSymbolIntoDisplayModel ()". Debe adaptar el número de modelos de visualización y rutas a los archivos DWT y .tbdm.
Para importar símbolos de varios modelos de visualización mediante un script VBA
Un mensaje le indicará que descargue el activador de VBA de Autodesk AutoCAD si no lo ha instalado.
Si el sistema muestra un mensaje de advertencia acerca de las macros, haga clic en Activar macros.