3DEXPERIENCE Transition 작업으로 매크로를 실행하려면:
- 3DEXPERIENCE Transition 작업에서 매크로를 실행할 파일을 선택합니다. 3DEXPERIENCE Transition 작업 생성을 참조하십시오.
- 다음을 클릭합니다.
- 옵션 대화 상자의 사용자 지정 작업 아래에서 매크로 실행:을 선택합니다.
- SOLIDWORKS 매크로(.swp)를 찾습니다.
- 마침을 클릭합니다.
작업 스케줄러에 작업에 대해 설정한 제목과 함께 매크로가 나타납니다.
SOLIDWORKS 매크로 샘플
이 기능을 테스트하려면 다음 텍스트를 SOLIDWORKS 매크로(.swp)에 붙여넣을 수 있습니다.
이 매크로 샘플은 "Hello World" 값을 가지는 "Hello"라는 이름의 속성을 작업 파일 목록에 있는 파트, 어셈블리 또는 도면에 추가합니다.
- 파트와 어셈블리의 경우, 활성 설정에 설정별 속성을 추가합니다.
- 도면의 경우, 도면에는 설정이 포함되지 않기 때문에 사용자 정의 속성이 추가됩니다.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim config As SldWorks.Configuration
Dim cusPropMgr As SldWorks.CustomPropertyManager
Dim lRetVal As Long
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If swModel Is Nothing Then
' If no model is currently loaded, then exit
Exit Sub
End If
If (swModel.GetType <> swDocDRAWING) Then
' Add a Configuration Property named "Hello" to the active configuration for a Part or Assembly
Set config = swModel.GetActiveConfiguration
Set cusPropMgr = config.CustomPropertyManager
lRetVal = cusPropMgr.Add3("Hello",
swCustomInfoType_e.swCustomInfoText, "Hello World",
swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
Else
' Add a Property named "Hello" for a Drawing
Set cusPropMgr = swModel.Extension.CustomPropertyManager("")
lRetVal = cusPropMgr.Add3("Hello",
swCustomInfoType_e.swCustomInfoText, "Hello World",
swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
End If
End Sub