Dim ObjClassFac As SwDMClassFactory
Dim swDM As SwDMApplication
Dim swDoc As SwDMDocument12
Dim swCfgMgr As SwDMConfigurationMgr
Dim mopenErrors As SwDmDocumentOpenError
Dim swcfg As SwDMConfiguration
Dim custpropertynames As Variant
Dim custpropertyname
Dim swdoctype As Integer
Dim a As Boolean
Const swDMlicensekey = "swdm许可序列号"
Sub getproperties()
Set ObjClassFac = CreateObject("SwDocumentMgr.SwDMclassfactory")
Set swDM = ObjClassFac.GetApplication(swDMlicensekey)
row = 3
f = Sheet1.Cells(row, 1)
200
If f <> "" Then
If UCase(Right(f, 6)) = "SLDPRT" Then
swdoctype = 1
Else
swdoctype = 2
End If
Set swDoc = swDM.GetDocument(f, swdoctype, False, mopenErrors)
Set swCfgMgr = swDoc.ConfigurationManager
Set swcfg = swCfgMgr.GetConfigurationByName("默认")
'swcfg.DeleteCustomProperty "图号"
'a = swcfg.AddCustomProperty("图号", 30, Sheet1.Cells(Row, 3))
'Debug.Print Sheet1.Cells(Row, 3)
'Debug.Print a
Sheet1.Cells(row, 4) = swcfg.GetCustomProperty("车型", swDmCustomInfoText)
Sheet1.Cells(row, 5) = swcfg.GetCustomProperty("图号", swDmCustomInfoText)
Sheet1.Cells(row, 7) = swcfg.GetCustomProperty("版本号", swDmCustomInfoText)
Sheet1.Cells(row, 8) = swcfg.GetCustomProperty("材料", swDmCustomInfoText)
Sheet1.Cells(row, 9) = swcfg.GetCustomProperty("下料尺寸", swDmCustomInfoText)
Sheet1.Cells(row, 10) = swcfg.GetCustomProperty("加工工艺", swDmCustomInfoText)
Sheet1.Cells(row, 11) = swcfg.GetCustomProperty("备注", swDmCustomInfoText)
swDoc.CloseDoc
'Sheet1.Cells(row, 12) = "已处理"
row = row + 1
Debug.Print row
f = Sheet1.Cells(row, 1)
GoTo 200
End If
End Sub |