×
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

Assign Part Name To Attributes Using Grip

Assign Part Name To Attributes Using Grip

Assign Part Name To Attributes Using Grip

(OP)
What is the code for GRIP to recognize a part name and assign it to the part attributes. The file name is GE81001234.prt. I want the attributes to read Title = Part Name and the Value = 81001234 with no "GE" attached.

Larry Leonard
Designer

Smith-Nephew Orthopaedics

RE: Assign Part Name To Attributes Using Grip


assatt/part,'PARTNAME',substr(&partname,3,10)

It's all spelled out in the GRIP manuals.

"Wildfires are dangerous, hard to control, and economically catastrophic."
"Fixed in the next release" should replace "Product First" as the PTC slogan.

Ben Loosli
CAD/CAM System Analyst
Ingersoll-Rand

RE: Assign Part Name To Attributes Using Grip

(OP)
Thanks Ben,
Have not been able to put my hands on the GRIP manuals.
I have been looking to get assistance from our support people but decided to go on my own.
Trying to pick up as much as I can from the HELP files.
If you can help me further I would greatly appreciate it.

Larry Leonard
Designer

Smith-Nephew Orthopaedics

RE: Assign Part Name To Attributes Using Grip

Just ask away. Been doing GRIP for 18 years.

"Wildfires are dangerous, hard to control, and economically catastrophic."
"Fixed in the next release" should replace "Product First" as the PTC slogan.

Ben Loosli
CAD/CAM System Analyst
Ingersoll-Rand

RE: Assign Part Name To Attributes Using Grip

Here is what the completed program would look like:

ASATT/PART,'PartName',SUBSTR(&PNAME,3,10)
HALT

Ben is right in that the help files are a good place to get this from, but sometimes you need a nudge in the right direction. Since this is such a short program I'll explain what is going on.
ASATT/ - this is the key word used to assign attributes
PART - minor word that tells it to assign the attribute to the part rather than an individual entity
'PartName' - this will be the title of your attribute
SUBSTR(&PNAME,3,10) - this will be the value of your attribute, it has 2 parts so let's break it down further
&PNAME - this grip statement will return the current part name, in our case it would be GE81001234.prt
SUBSTR - this is the keyword to extract part of a string. The syntax is SUBSTR('string',<start>,<end>)
So, SUBSTR(&PNAME,3,10) tells it to extract characters 3-10 of the part name (in this case 81001234).

SUBSTR(&PNAME,3,10) will work as long as there are always 2 characters at the beginning that you don't need and you always want the next 8 characters. If the part name lengths are variable then the grip program gets more complicated.

RE: Assign Part Name To Attributes Using Grip

(OP)
1 - How hard would it be to have this happen automatically when a part is created in UG?
2 - How hard would it be to have the TITLE: DESCRIPTION filled in automatically and then have a screen ask for a user entry for the VALUE:__________. (Just less trying for the user)

Larry Leonard
Designer

Smith-Nephew Orthopaedics

RE: Assign Part Name To Attributes Using Grip

You have to execute the GRIP program to get iot to do anything. The only way to do it transparently is to use a user exit at file create or file save. Our users haven't seen a standard UG File-Open/Save/Create/SaveAs menu since before I came here 11 years ago. The File-XXXX commands have all been replaced by custom GRIP programs that add the attributes to the part file and check them at save time.

You could do it with a macro/NX3 journal.

GRIP can also ask for a value and then assign the attribute.

"Wildfires are dangerous, hard to control, and economically catastrophic."
"Fixed in the next release" should replace "Product First" as the PTC slogan.

Ben Loosli
CAD/CAM System Analyst
Ingersoll-Rand

RE: Assign Part Name To Attributes Using Grip

(OP)
No problem on the execution.

How do I combine the code:

assatt/part,'P/N',substr(&partname,3,10)
   Title: P/N    Value: 81001234

popup on the screen will ask the user to input info
Title: DESCRIPTION  Value: user input.

Title: MATERIAL  Value: ALUMINUM

Title: FINISH  Value: ANODIZE

Larry Leonard
Designer

Smith-Nephew Orthopaedics

RE: Assign Part Name To Attributes Using Grip

All documentation for UG comes on a CD.

Text/'Enter Value:',valvar1
assatt/part,'title',valvar1

It can get a lot more complicated with error trapping and good value checks.

"Wildfires are dangerous, hard to control, and economically catastrophic."
"Fixed in the next release" should replace "Product First" as the PTC slogan.

Ben Loosli
CAD/CAM System Analyst
Ingersoll-Rand

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