Dim swApp As Object '让程序以相同的文件名把PDF/DXF/STEP文件保存在指定的文件夹内
Dim swdraw As SldWorks.DrawingDoc
Dim drawcom As DrawingComponent
Dim compenent As Component2
Dim part As Object
Dim swview As View
Dim Filename As String
Dim No As Integer
Dim Title As String
Dim configname As String
Sub main()
Dim partname As String
Set swApp = Application.SldWorks
Set swdraw = swApp.ActiveDoc
Set swview = swdraw.GetFirstView
Set swview = swview.GetNextView
Set part = swview.ReferencedDocument
configname = part.ConfigurationManager.ActiveConfiguration.Name
Filename = part.GetPathName()
No = Len(Filename)
Filename = Left(Filename, No - 7)
partname = Get_Property_value(part, "零件号")
leibie = Get_Property_value(part, "零件类别")
Title = Right(Filename, Len(Filename) - InStrRev(Filename, "\"))
Public Function Get_Property_value(swDoc As ModelDoc2, Property_Name As String) As String
Dim swModelDocExt As ModelDocExtension
Dim swCustProp As CustomPropertyManager
Dim val As String '属性值
Dim valout As String '属性评估值
Dim bool As Boolean