|
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeature As SldWorks.feature
Dim FeatName As String
Dim FeatType As String
Sub main()
Set swApp = Application.SldWorks
If Not swApp Is Nothing Then
Set swModel = swApp.ActiveDoc
If Not swModel Is Nothing Then
Set swFeature = swModel.FirstFeature
While Not swFeature Is Nothing '遍历零件FeatureManager并获取特征和属性
FeatName = swFeature.Name '获取特征名称
FeatType = swFeature.GetTypeName '获取特征属性
If FeatType = "CutListFolder" Then
swFeature.Name = "切割清单项目" '修改名称
End If
Set swFeature = swFeature.GetNextFeature
Wend
End If
Set swModel = Nothing
End If
Set swApp = Nothing
blnretval = swModel.DeleteCustomInfo2("", "长") '清除原有的属性
blnretval = swModel.DeleteCustomInfo2("", "宽")
blnretval = swModel.AddCustomInfo3("", "长", swCustomInfoText, """SW-边界框长度@@@切割清单项目@零件3.SLDPRT""") 'VB语法,两个引号组成一个引号
blnretval = swModel.AddCustomInfo3("", "宽", swCustomInfoText, """SW-边界框宽度@@@切割清单项目@零件3.SLDPRT""")
End Sub |
|