Check for iproperty value

Check for iproperty value

bob_clark5J5M8
Contributor Contributor
544 Views
2 Replies
Message 1 of 3

Check for iproperty value

bob_clark5J5M8
Contributor
Contributor

Hi, hope someone can help, it's been a few years since I did any iLogic

 

The company I am in uses custom iprops for the revision of drawings

 

e.g.

 

REV1

REV2

REV3

REV4

REV5

 

I would like to check if there is a value in REV5, If nothing then check if a value exists in REV4 etc.

 

When a value is found, write the value to  iProperties.Value("Project", "Revision Number") and stop searching for any other values.

 

Can someone kindly help pls?

 

Many thanks )

0 Likes
Accepted solutions (1)
545 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Maybe something like this would help you in that situation?

 

oDoc = ThisDoc.Document
oCProps = oDoc.PropertySets.Item("Inventor User Defined Properties")
If oCProps.Count = 0 Then Exit Sub
Dim oRevPropNames As New List(Of String)
For Each oCProp As Inventor.Property In oCProps
	If oCProp.Name.StartsWith("REV")
		oRevPropNames.Add(oCProp.Name)
	End If
Next
If oRevPropNames.Count = 0 Then Exit Sub
oRevPropNames.Sort 'alpha/numeric normal order
oRevPropNames.Reverse 'reverse order (REV5 before REV4)
Dim oVal As String = ""
For Each oPropName In oRevPropNames
	oVal = CStr(oCProps.Item(oPropName).Value)
	If oVal = "" Then
		Continue For
	Else
		Exit For
	End If
Next
oDoc.PropertySets.Item("Inventor Summary Information").Item("Revision Number").Value = oVal

 

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

bob_clark5J5M8
Contributor
Contributor

perfect, very tidy, thank you

0 Likes