Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX9 - VB Code for Attributes (Hope you like a challenge)

Status
Not open for further replies.

Kenja824

Automotive
Nov 5, 2014
949
We have to add this note to a lot of different drawing sheets we work on...
-BUILD EVENT: xxxxxxxxx
-KCDS DESIGNATION: STD CARE UNLESS OTHERWISE NOTED
-PE DISPENSE FILE: xxxxxxx/xxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-BEADS FOLLOW PRODUCT FEATURES UNLESS OTHERWISE NOTED
-PULL OUT STA NO: N/A

(The info in place of the xxxxxx will change from file to file that we work on.)

1) It doesnt make sense to have someone type this out every time. So i figured to make it a part file of its own that a button will import. Makes it simple. Hit a button, the entire note appears.

2) My bosses dont want to make people have to go into each note and type out the different info on each sheet it is needed. So I thought of adding three attributes to the poperties of a file and have the notes connect to the attributes. Like adding <W@PAINT_CODE> in place of the xxxx and creating a poperty attribute for PAINT_CODE. Then it only needs to be typed out once and every time we add the note, it will automatically complete.

I have code that works for importing files. What I dont know how to do is write .vb code that before importing the part file, it will check to see if three specific attributes are available, and if not, it will promp someone to fill out the info and then automatically create the attributes for them. Then it will import the note's part file.

I am pretty sure I am making this confusing. I have a bad habit of that. lol

 
Replies continue below

Recommended for you

I get the following error.... the top and the bottom line showing are what gets hi-lighted if I select the two errors


ERROR2_rr7isj.jpg
 
I think I see it. I read the are above that I saw I may not have the DLX file in the right place. Let me see how that does.
 
can u post ur prt so i can test it here and try discover the problem ?

the DLX its like Style Sheet

NX8.5 - NX9 - NX 10 - NX11
 
i think i found your problem its because main its declared as public shared

i will try to make a buton fo your import and call the function thru there, i will send it on monday

NX8.5 - NX9 - NX 10 - NX11
 
ok thanks

I do appreciate it all. Hope you have a great weekend.
 
Try the files attached and tell-me the result

(dont forget to put the path to the DLX, and the PRT)

Code:
theDlxFileName = "PATHTODLX:\checkAttributes.dlx"

Code:
 partImporter1.FileName = "PATHTOPRT.prt"

to import the prt press the "no title" button

NX8.5 - NX9 - NX 10 - NX11
 
 http://files.engineering.com/getfile.aspx?folder=f8149d38-fd92-4d23-86b6-a152604e9689&file=check.7z
Hey Vegetagaru

Sorry I didnt reply yesterday. Bosses were pushing for specific things to get done yesterday and I never even had a chance.

So I tried these files. When I played back the VB code file, it brought up the attribute box and I filled that out and hit OK. It disappeared and then that was it. No note ever appeared. For now I have set up separate buttons that work fine. One button to add the attributes and one to bring in the note's .prt file.

I matched the code from the working vb file that brings in the note to the same section in your new vb file. They seem to be exactly the same, so to test it, I coppied the one to the other and tried it. Same results. No note prt file was imported.

Not understanding what it all means enough, I wonder about the location of the .dlx file still. There is a section in the code stating where the dlx file needs to be and I asked our IT person where UG launches from. But I question if it is possible they gave me the wrong location and that is the problem? Is there a specific file that this DLX file should be in the same folder with?

I will be honest with you. If it is not difficult to figure out what is wrong, that would be great to have it working with one button. But if it is something you would have to study and spend much time on, the two button way of things works okay. You have helped me immensely. The attribute code alone is awesome. I do not wish to put you through a hassle just to combine two buttons if the two are working.



 
sorry i was away, family problems, i will try to "see" your reply today

NX8.5 - NX9 - NX 10 - NX11
 
can u attach the prt that contains the tabble ? (the one that you import)

NX8.5 - NX9 - NX 10 - NX11
 
Here is my file. You will find it is not just a note but a note turned into a symbol. Boss man wanted this because the people working on this area are very inexperienced and in doing this they cant accidentally change it. I doubt that will make any difference to you, but I figured I would explain it so you dont look at it and wonder why the heck we would make a note a symbol. lol
 
 http://files.engineering.com/getfile.aspx?folder=de0395af-ee79-4663-9d0b-e6181be39775&file=Build_Note.prt
np :) i will try here then i will post feedback asap

i dont mind taking the challenge because i want to be better @ journaling and understand it, so this is perfect :) thank you



NX8.5 - NX9 - NX 10 - NX11
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor