Change display information at message prompt

Change display information at message prompt

K.TRYFONIDIS
Advocate Advocate
557 Views
4 Replies
Message 1 of 5

Change display information at message prompt

K.TRYFONIDIS
Advocate
Advocate

Hello everyone, new one here. First post.


I am trying to code some things for my company and i am using different forms to fill in iproperties.

The case is that i want to set 3 custom iproperties but in the display box i dont want to show the name of the variables
i would like to show a custom text defined by me.

This is my code


customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

Dim iprop(3) As String
iprop(1) = "DESCRIPTION"
iprop(2) = "NyfanID"
iprop(3) = "NyfanCurrentRev"

For k = 1 To 3
Dim prop(k) As String
    Try
        prop(k) = iProperties.Value("Custom", iprop(k))
    Catch
        'Assume error means not found
        customPropertySet.Add("", iprop(k))
        iProperties.Value("Custom", iprop(k)) = "null"
    End Try
Next

For j = 1 To 3
    Dim var(j) As String
    If iProperties.Value("Custom", iprop(j)) = "null" Then
        var(j) = InputBox("ΣΥΜΠΛΗΡΩΣΕ ΤΙΜΗ ΓΙΑ: " & iprop(j), "ΚΑΤΑΧΩΡΗΣΗ ΤΙΜΩΝ", "")
        iProperties.Value("Custom", iprop(j)) = var(j)
    End If
Next




And this is the message prompt:

kTRIFONIDIS_0-1642757644901.png
Where instead of Description i would like to say something else like "Περιγραφή" but i want to keep the variable as 

description.

is there any way to do this?  I am guessing i should "Break" the for command and do it somehow individually.



 

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

vpeuvion
Advocate
Advocate

Hi, you can try this with Dictionary(Of String,String).

customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

Dim iprop As New Dictionary(Of String, String)
iprop.add("DESCRIPTION","YourName1")
iprop.add("NyfanID","YourName2")
iprop.add("NyfanCurrentRev","YourName3")

For Each Pair As KeyValuePair(Of String,String) In iprop
For k = 1 To iprop.count
Dim prop(k) As String
    Try
        prop(k) = iProperties.Value("Custom", Pair.key)
    Catch
        'Assume error means not found
        customPropertySet.Add("", Pair.key)
        iProperties.Value("Custom", Pair.key) = "null"
    End Try
Next

For j = 1 To iprop.count
    Dim var(j) As String
    If iProperties.Value("Custom", Pair.Key) = "null" Then
        var(j) = InputBox("ΣΥΜΠΛΗΡΩΣΕ ΤΙΜΗ ΓΙΑ: " & Pair.Value, "ΚΑΤΑΧΩΡΗΣΗ ΤΙΜΩΝ", "")
        iProperties.Value("Custom", Pair.key) = var(j)
    End If
Next
Next

Hope this can help you.

Vincent.

 

0 Likes
Message 3 of 5

K.TRYFONIDIS
Advocate
Advocate
Accepted solution

All i had to do is put bellow variable declaration this:

Dim msg(3) As String
msg(1) = "desired msg1"
msg(2) = "desired msg2"
msg(3) = "desired msg3"

 

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Hi @K.TRYFONIDIS.  Just so you are aware...when you create that Array of String using 'msg(3)', you are actually creating a 4 element array, not a 3 element array, because array's are zero based (first element is at zero position, not 1).  Since you are using For 1 To 3, this is not producing any problems, but if you used a For Each loop, the first element (msg(0)) would not contain a value, the way you coded it.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

K.TRYFONIDIS
Advocate
Advocate
aha! very helpful to know! Thanks!
0 Likes