Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IFRs on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi , I have DL a test journal "d

Status
Not open for further replies.

lklo

Industrial
Nov 24, 2010
226
Hi ,

I have DL a test journal "define_part_attributes_with_blockstyler.vb" from GTAC programming examples .
I know it just examples , but I have 1 question to the attached example.

The program set´s two partattribute´s - COLOR and FINISH.

When I run the journal , it is 3 options to each Attribute ( red,green,blue for COLOR and nitrate,polish,mill for FINISH).
So long it work´s great.

But if I run the journal one more time ,and the attribute COLOR is already set(Ex "green", this value from the attribute is not present in the dialog.
The present value is always the first value defined in the stringArray.

When I read the program ,I understand why it work´s so..

But should it be possible to get the current value of an existing attribute (COLOR or FINISH), present in the dialog ( created from Block Styler)?

lko


 
Replies continue below

Recommended for you

To have the dialog show possible existing attributes you need to code this in the dialogShown_cb() sub. Any dialog items can be changed here before the dialog is shown.

So instead of just displaying three values for COLOR & FINISH by reading existing attributes and if they exist then their values can be added as shown in the sample code

Code:
'assuming you have found the attribute values as string variables color1 and finish1

            Dim stringArray(3) As String
            stringArray(0) = "Red"
            stringArray(1) = "Green"
            stringArray(2) = "Blue"
            stringArray(3) = color1
            enum0.GetProperties().SetEnumMembers("Value", stringArray)
            stringArray(0) = "Nitrate"
            stringArray(1) = "Polish"
            stringArray(2) = "Mill"
            stringArray(3) = finish1
            enum01.GetProperties().SetEnumMembers("Value", stringArray)

If you need help in getting the attribute vaues you need to let me know what version of NX you are using.

Frank Swinkels
 
hi again

thank you for your quick answer , but I think I don´t have explained me very well (sorry).

I understand your solution - but what I want it to do is - if one of the 3 values is already set as a attribute,
next time I run the journal, the actually value should be "visible" in the dialog,so the user know what the current value is at current moment.
As it is now ,always "Red" is shown as the first choice. (and "Nitrate" ind the next field).

----
maybe a solution will be to set all values in the stringarray as variables ,and then the first varibale should be "triggered" to show either existing attribute value if it exixt, else
the first varibale must be set as "Red" , in the stringarray.....

----
lklo
 
Yes, for that we need to read the existing attribute. The way to read the attributes has changed in NX8, that is the reason Frank asked you what version of NX are you running. Depending the version we can post the code to read the attribute value.


Suresh
 
hello again -
NX 8.0.3.4

lklo

 
If I assume correctly what you are looking for is how to make the existing attribute color and finish (if they exist) as the visible item. One way of doing this is with an extra line in the same sub which reads

enum0.GetProperties().SetEnum("Value", 2)

This means that the attribute for color was Blue. That is the third entry in the list. This means that the enum will show Blue.

Frank Swinkels
 
hi again - I will give it a try later today..

lklo
 
Hi Frank,

Thank´s a lot,
it work´s great with the "enum0.GetProperties().SetEnum("Value", 2)",but in my case,first I have to ask for each attribute , if they exist,(UF)
and if the attribute exist,ask for the value.Then calculate what number the value have in the array ,and then put that number (as variable - array_number -) in the
enum0.GetProperties().SetEnum("Value", array_number) ,<<< "2" replaced with the number variable.
I have written all attribute´s , array´s and array values (Enum) as variable , so it is very easy to set up for example 10 predefined part attributes containing 5 options each, in this journal.

The advantage with this solution is, if all attribute´s is set once , and the user have to change one of them, the remaining 9 attribute is preserved,and the user don´t have to set them again.

lklo

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor