catia的vba安装包是什么(CATIA二次开发VBA)
不喜欢文字三千行,代码二十字,简单上:
Public Function ProductProperties(ByVal Oproduct As Product, ByVal PropStr As String, OpIndex As String) As String
On Error Resume Next
Dim parameters1 As Parameters
Set parameters1 = Oproduct.UserRefProperties
Dim EvPara() As String, Ev As Integer, GetInfo(5) As String
Select Case OpIndex
Case "Create"
EvPara = Split(PropStr, "->")
parameters1.CreateString "单位名称", EvPara(0)
parameters1.CreateString "图纸名称", EvPara(1)
parameters1.CreateString "图纸编号", EvPara(2)
parameters1.CreateString "材料名称", EvPara(3)
parameters1.CreateString "设计", EvPara(4)
parameters1.CreateString "Standard", EvPara(5)
ProductProperties = "Created"
Case "Read"
If parameters1.Count = 0 Then ProductProperties Oproduct, "单位->图名->编号->材料->设计->No", "Create"
GetInfo(0) = parameters1.Item("单位名称").ValueAsString
GetInfo(1) = parameters1.Item("图纸名称").ValueAsString
GetInfo(2) = parameters1.Item("图纸编号").ValueAsString
GetInfo(3) = parameters1.Item("材料名称").ValueAsString
GetInfo(4) = parameters1.Item("设计").ValueAsString
GetInfo(5) = parameters1.Item("Standard").ValueAsString
ProductProperties = Join(GetInfo, "->")
Case "Modify"
If parameters1.Count = 0 Then ProductProperties Oproduct, "单位->图名->编号->材料->设计->No", "Create"
EvPara = Split(PropStr, "->")
parameters1.Item("单位名称").ValuateFromString EvPara(0)
parameters1.Item("图纸名称").ValuateFromString EvPara(1)
parameters1.Item("图纸编号").ValuateFromString EvPara(2)
parameters1.Item("材料名称").ValuateFromString EvPara(3)
parameters1.Item("设计").ValuateFromString EvPara(4)
parameters1.Item("Standard").ValuateFromString EvPara(5)
ProductProperties = "Modified"
End Select
End Function
以上是完整示例,自己调整、稍作修改后即可用在工作中了,爽的话就赞就关注,我自己的作品示例:
,
免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com