To Update a Display Model with Imported Symbols

If you have used customized symbols in your display models and want to update them with modified symbols, you can open the display model, generate the graphic, and use MAPSYMBOLIMPORTEXPORT to import the modified symbols. For details, see To Import Symbols.

    To import symbols in batch, without a user interface

  1. In Global Industry Model Options Generate Graphic, select Reuse Current Drawings.
  2. Open the project that your display model applies to, and start with an empty drawing.
  3. Set both CMDDIA and FILEDIA system variables to 0 (zero).
  4. At the Command prompt, enter TBDMOPEN.
  5. Following the prompt, enter the path to the display model that you want to modify.
  6. Enter command TBGENERATEGRAPHIC.
  7. Enter command MAPSYMBOLIMPORTEXPORT.
  8. Following the prompt, choose Import.
  9. Enter the path to the symbol file that contains the symbols you want to import.
  10. Choose an import option to specify how you want to select the symbols in the UI.
  11. Finish the import, then enter command TBDMSAVE.

As an alternative, you could automatically complete the steps above by script. In the command line, load the script file with the SCRIPT command and wait until finished. When you execute several scripts for different display models, make sure to always start with an empty drawing, before open the display model. Otherwise you will save old layers from the previous drawing to the new display model.

The following is a sample script. You can save it as a file with a .scr extension.

CMDDIA 0
FILEDIA 0
_TBDMOPEN [path to your TBDM file]
_TBGENERATEGRAPHIC
_MAPSYMBOLIMPORTEXPORT _IMPORT [choose options that fit your needs]
_TBDMSAVE
When you are finished with the script, set the variables CMDDIA and FILEDIA back to their original values, which are usually '1'.

VBA Script Option

To save time, you can import the symbols for many display models in a single operation, using a Microsoft Visual Basic for Applications (VBA) script. The following script is a sample. You can use it as a template, make the required modifications, and then save it as a .bas file.

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

In the example script, there is a module "ImportSymbolInto_IM_DM" with a sub "ImportSymbolIntoDisplayModel ()". You need to adapt the number of display models and paths to the DWT and the .tbdm files.

To import symbols for multiple display models, using a VBA script

  1. On the Map 3D command line, enter VBAIDE to open the Microsoft VBA window.

    A message will tell you to download the Autodesk AutoCAD VBA Enabler if you have not installed it.

  2. In the Microsoft VBA window, do the following:
    1. Click the File and select Import File.
    2. In the Import File dialog box, find and select the .bas file that contains the script.
    3. Click Open.
    4. In the Microsoft VBA window, Click Save.
    5. In the Save As dialog box, specify the path and file name, then click Save.
  3. Close the Microsoft VBA window.
  4. On the command line, enter VBALOAD to load the .dvb file you saved above.

    If the system warns you about the macros, click Enable Macros.

  5. On the command line, enter VBARUN and choose the related macro to run.