Message 1 of 4
Adding custom iProperties to idw ussing the vb.net Inventor API (Code included)

Not applicable
06-01-2016
08:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I know how to create custom iproperties for either iparts and assemblies, but cant create any for my idw drawings? I cant get the same thing done for the iproperties of idw files? Th code I have sofar is as follows
Dim invApp As Inventor.Application invApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") Dim Doc As Inventor.Document Doc = invApp.ActiveDocument UpdateCustomiProperty(Doc, "MYPROPERTY", textbox1.text) Doc.Update() Private Sub UpdateCustomiProperty(ByRef Doc As Inventor.Document, ByRef PropertyName As String, ByRef PropertyValue As Object) ' Get the custom property set. Dim customPropSet As Inventor.PropertySet customPropSet = Doc.PropertySets.Item("Inventor User Defined Properties") ' Get the existing property, if it exists. Dim prop As Inventor.Property = Nothing Dim propExists As Boolean = True Try prop = customPropSet.Item(PropertyName) Catch ex As Exception propExists = False End Try ' Check to see if the property was successfully obtained. If Not propExists Then ' Failed to get the existing property so create a new one. prop = customPropSet.Add(PropertyValue, PropertyName) Else ' Change the value of the existing property. prop.Value = PropertyValue End If End Sub
The error i get is the following screenshot...
Now Im just confused 😞
mabey one of you guys can help me out?