美文网首页
002 - Inventor文件中创建或更新iProperty属

002 - Inventor文件中创建或更新iProperty属

作者: 怪怪001 | 来源:发表于2023-11-03 21:22 被阅读0次

    Sub Main()

        FindOrCreateProperty("PS_Name", "Username")

        FindOrCreateProperty("PS_Date", "1/1/2011")

        FindOrCreateProperty("PS_Time", "12:00 AM")   

    End Sub

    创建或更新iProperty属性值的方法

    Function FindOrCreateProperty(propName As String, propValue As Object)

        ' 获得当前文件

        oDoc = ThisDoc.Document

        ' 获得用户自定义参数属性

        Dim propSet As PropertySet = oDoc.PropertySets.Item("Inventor User Defined Properties")

        Dim invProperty As Inventor.Property

        ' 属性是否存在,如果存在,不改变属性值。

        For Each invProperty In propSet

            If (invProperty.Name = propName) Then Return invProperty

        Next

        ' 创建属性

        invProperty = propSet.Add(propValue, propName)

    End Function

    相关文章

      网友评论

          本文标题:002 - Inventor文件中创建或更新iProperty属

          本文链接:https://www.haomeiwen.com/subject/zlgoidtx.html