디스플레이 모형에서 사용자화된 기호를 사용했고 이를 수정된 기호로 업데이트하려는 경우 디스플레이 모형을 열고, 그래픽을 생성하고, MAPSYMBOLIMPORTEXPORT를 사용하여 수정된 기호를 가져올 수 있습니다. 자세한 내용은 기호를 가져오려면을 참고하십시오.
사용자 인터페이스 없이 배치의 기호를 가져오려면
그래픽 생성에서 현재 도면 재사용을 선택합니다.
또는 스크립트를 통해 위의 단계를 자동으로 완료할 수 있습니다. 명령행에서 SCRIPT 명령으로 스크립트 파일을 로드하고 완료될 때까지 기다려 주십시오. 다양한 디스플레이 모형에 대해 여러 가지 스크립트를 실행할 때, 디스플레이 모형을 열기 전에 항상 빈 도면으로 시작하십시오. 그렇지 않으면 이전 도면의 기존 도면층을 새 디스플레이 모형에 저장합니다.
다음은 샘플 스크립트입니다. 스크립트를 .scr 확장자를 가진 파일로 저장할 수 있습니다.
CMDDIA 0 FILEDIA 0 _TBDMOPEN [path to your TBDM file] _TBGENERATEGRAPHIC _MAPSYMBOLIMPORTEXPORT _IMPORT [choose options that fit your needs] _TBDMSAVE스크립트를 끝내면 CMDDIA 및 FILEDIA 변수를 다시 원래 값(일반적으로 '1')으로 설정합니다.
시간을 절약하려면 Microsoft VBA(Visual Basic for Applications) 스크립트를 사용하여 많은 디스플레이 모형에 대한 기호를 단일 작업으로 가져올 수 있습니다. 다음 스크립트는 샘플입니다. 스크립트를 템플릿으로 사용하고, 필요한 내용을 수정한 후, .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
예제 스크립트에는 하위 "ImportSymbolIntoDisplayModel ()"을 포함하는 "ImportSymbolInto_IM_DM" 모듈이 있습니다. 디스플레이 모형 및 경로 수를 DWT 및 .tbdm 파일에 맞춰야 합니다.
VBA 스크립트를 사용하여 다중 디스플레이 모형에 대한 기호를 가져오려면
Autodesk AutoCAD VBA Enabler를 설치하지 않은 경우 다운로드하라는 메시지가 나타납니다.
매크로에 대한 경고가 표시되면 매크로 사용을 클릭합니다.