iLogic check the Type of Custom iProperties

iLogic check the Type of Custom iProperties

douthett
Collaborator Collaborator
2,042 Views
4 Replies
Message 1 of 5

iLogic check the Type of Custom iProperties

douthett
Collaborator
Collaborator

I'm hoping someone can point me in the right direction for what I'm trying to do

 

My company has a number of custom iProperties, some of which has different type of Type, ie Boolean, Number... 

 

With the number of users and the number of files my compnay has, it's not unexpected to have one or more of the custom iProperties Type change to Text.  What I want to do is write a code that would check to see if the Type is correct and if not for it alert the user.

 

And I am stumped.

 

0 Likes
Accepted solutions (1)
2,043 Views
4 Replies
Replies (4)
Message 2 of 5

Balaji_Ram
Alumni
Alumni
Accepted solution

Hi,

 

Here is a code snippet to iterate the custom properties and display its type :

 

Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument

Dim invCustomProps As PropertySet
invCustomProps = oPartDoc.PropertySets.Item("User Defined Properties")

Dim oProp As Inventor.Property
For Each oProp In invCustomProps
	If TypeOf oProp.Value Is Integer Then
		MessageBox.Show(oProp.Name & " is Integer type : " & oProp.Value, "iProperty type check")
	Else If TypeOf oProp.Value Is Date Then
		MessageBox.Show(oProp.Name & " is Date type : " & oProp.Value, "iProperty type check")
	Else If TypeOf oProp.Value Is Boolean Then
		MessageBox.Show(oProp.Name & " is YesNo type : " & oProp.Value, "iProperty type check")
	End If
Next

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 5

douthett
Collaborator
Collaborator

Thanks you for the code.  It's the exact type of signpost I needed.   I can now play with it so it only check iproperties we need check.

0 Likes
Message 4 of 5

douthett
Collaborator
Collaborator

How would you write it if you're check to see if it's text?

0 Likes
Message 5 of 5

douthett
Collaborator
Collaborator

Never mind.  I figure it out.  it was String

0 Likes