本帖最后由 DaveChan 于 2017-1-10 11:02 编辑
- Option Explicit
- Dim swApp As Object
- Dim Part As Object
- Dim Filename As String
- Dim Title As String
- Dim sMatName As String
- Dim sMatDB As String
- Sub main()
- Set swApp = Application.SldWorks
- Set Part = swApp.ActiveDoc
- Filename = Part.GetPathName()
- Filename = Left(Filename, Len(Filename) - 7)
- If Part.GetType = 1 Then
- sMatName = Part.GetMaterialPropertyName2(Part.GetActiveConfiguration.Name, sMatDB)
- If sMatName = "" Then sMatName = "材质未指定"
- Filename = Filename & "-" & sMatName
- ElseIf Part.GetType = 2 Then
- Filename = Filename & "-组件图"
- End If
- Part.SaveAs2 Filename & ".IGS", 0, True, False
- Title = Part.GetTitle
- Set Part = Nothing
- 'swApp.CloseDoc Title
- 'X = MsgBox("输出IGS文件在SW工程图同一文件夹", 0)
- End Sub
复制代码
|