|
经典图书
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim value As String
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
' swModel.AddCustomInfo3 "", "MyTest", swCustomInfoText, "This is a test."
' ' Retrieve the value of a custom property called MyTest
' value = ""
' value = swModel.CustomInfo2("", "MyTest")
' swApp.SendMsgToUser2 value, 0, 0
'
' ' Change the value of a custom property called MyTest
' value = "Test has now changed!"
' swModel.CustomInfo2("", "MyTest") = value
' swApp.SendMsgToUser2 value, 0, 0
swModel.AddCustomInfo3 "", "MyProp1", swCustomInfotext, "垫片"
swModel.AddCustomInfo3 "", "MyProp2", swCustomInfoNumber, "筒体"
swModel.AddCustomInfo3 "", "MyProp3", swCustomInfoNumber, "3"
swModel.AddCustomInfo3 "", "MyProp4", swCustomInfoNumber, "4"
Dim retval() As String
Dim i As Integer
retval = swModel.GetCustomInfoNames2("")
For i = 0 To UBound(retval)
swApp.SendMsgToUser2 retval(i), 0, 0
Next
Dim count As Long
count = swModel.GetCustomInfoCount2("")
'swApp.SendMsgToUser2 "You have " & count & " custom properties.", 0, 0
swApp.SendMsgToUser2 _
"You have " & count & " custom properties.", 0, 0
End Sub
复制代码
结果如图所示
**********************
swCustomInfoType_e
swCustomInfoUnknown
swCustomInfoText
swCustomInfoDate
swCustomInfoNumber
swCustomInfoYesOrNo
swCustomInfoDouble |
|