×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Hi , I have DL a test journal "d

Hi , I have DL a test journal "d

Hi , I have DL a test journal "d

(OP)
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


RE: Hi , I have DL a test journal "d

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

RE: Hi , I have DL a test journal "d

(OP)
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

RE: Hi , I have DL a test journal "d


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
www.technisites.com.au

RE: Hi , I have DL a test journal "d

(OP)
hello again -
NX 8.0.3.4

lklo

RE: Hi , I have DL a test journal "d

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

RE: Hi , I have DL a test journal "d

(OP)
hi again - I will give it a try later today..

lklo

RE: Hi , I have DL a test journal "d

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources