MAPSYMBOLIMPORTEXPORT 명령 또는 Microsoft VBA 스크립트를 사용하여 단일 작업에서 여러 기호를 가져올 수 있습니다.
점, 선 또는 폴리곤 피쳐에 스타일을 지정할 때 로드 옵션을 사용하여 기호를 가져올 수 있습니다. 또한 아래에 설명된 대로 MAPSYMBOLIMPORTEXPORT 명령을 사용할 수 있습니다.
사용자 인터페이스를 사용하여 기호를 가져오려면
DWG 파일의 블록을 기호로 가져올 수 있습니다. 또한 기호 라이브러리(*.layer), 벡터 기호(*.xml), 해치 정의(*.pat), 선 스타일(*.lin) 또는 래스터 이미지(*.gif, *.jpg *.bmp *.png)를 기호 리포지토리에 가져올 수 있습니다.
사용자 인터페이스를 사용하지 않고 기호를 가져오려면
CMDDIA 0 FILEDIA 0 _MAPSYMBOLIMPORTEXPORT _IMPORT "C:\data\MySymbols.dwg" _YES
시간을 절약하려면 Microsoft VBA(Visual Basic for Applications) 스크립트를 사용하여 많은 도면에 대한 기호를 단일 작업으로 가져올 수 있습니다. 다음 스크립트는 샘플입니다. 스크립트를 템플릿으로 사용하고, 필요한 내용을 수정한 후, .bas 파일로 저장할 수 있습니다.
Attribute VB_Name = "ImportSymbolIntoDWG"
Sub ImportSymbolIntoAllDWG()
Dim fileSystemObject, fileSystemFolder, file, fileCollection
Dim collectionOfFiles As New Collection
Dim path As String
' Define where the DWG files are located
path = "C:\Autodesk\DWGFiles"
Dim prototypeDWG As String
' Define where the symbol(s) should be imported from
prototypeDWG = "C:\Autodesk\Prototype\Prototype_GA_modified.dwg"
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
'' use this to request the path
'path = ThisDrawing.Utility.GetString(1, vbCrLf & "Enter the path of the DWG files to update: ")
'prototypeDWG = ThisDrawing.Utility.GetString(1, vbCrLf & "Enter the path of the prototype DWG: ")
ThisDrawing.SetVariable "FILEDIA", 0
ThisDrawing.SetVariable "CMDDIA", 0
Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
Set fileSystemFolder = fileSystemObject.GetFolder(path)
Set fileCollection = fileSystemFolder.Files
For Each file In fileCollection
If UCase(Right(file.Name, 4)) = UCase(".dwg") Then
collectionOfFiles.Add file.path
End If
Next
For Each drawing In collectionOfFiles
Application.Documents.Open (drawing)
ThisDrawing.SendCommand "_MAPSYMBOLIMPORTEXPORT" & vbCr & "_IMPORT" & vbCr & prototypeDWG & vbCr & "_YES" & vbCr
ThisDrawing.Save
ThisDrawing.Close
Next drawing
End Sub
예제 스크립트에는 "ImportSymbolIntoAllDWG()" 하위를 포함한 "ImportSymbolIntoDWG" 모듈이 있습니다. 도면이 있는 경로를 지정하도록 "path" 변수를 수정하고, 가져올 기호를 포함하는 DWG 파일을 가리키도록 "prototypeDWG" 변수를 수정해야 합니다.
VBA 스크립트를 사용하여 다중 도면에 대한 기호를 가져오려면
Autodesk AutoCAD VBA Enabler를 설치하지 않은 경우 다운로드하라는 메시지가 나타납니다.
매크로에 대한 경고가 표시되면 매크로 사용을 클릭합니다.