×
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

BOM & Attributes.....

BOM & Attributes.....

BOM & Attributes.....

(OP)
I'm been using NX3 for a little while now and I am begining to look ahead to building some commercial part libraries and establish standard seed files.

This is what I need some advice on......

I am using standard attributes to build Parts Lists including the item no. because the standard "callout" isn't flexible enough in it's numbering schemes. Is there
a way to automatically apply the attributes to each part in my ass'y as I build? Ex: Can I assign a seed file to use as I create each part.....or can I use a utility of some kind to assign them to the parts after the design is complete?

I'm reluctant to start the libraries without a good strategy for this. It's a lot of work to have to key this stuff up on every job.

Thanks in advance for any help!

RE: BOM & Attributes.....

This is still a good case for GRIP. I have a program that will assign 4 attributes to a part file that we use in our BOM.

"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: BOM & Attributes.....

(OP)
Are you using Grip to assign the attributes after the design is done?

I'm an autocad guy and used to use a programming language called autolisp to automate common tasks, commands etc.... They could be activated with a keystroke, menu or toolbar.

Is "grip" the UG equivilant for this?

Dave

RE: BOM & Attributes.....

Yes, GRIP is a basic-like language that can do simple things like add attributes to a file, basic file manipulation tasks, etc. It is not a maintained product, but UGS does make sure it will still function in new releases. They actually did some enhancements to it for the new NX3 plotting.

My GRIP program is run by the designer after he has finished the design.

Here is my simple program to add 2 attributes to a file.

number/rsp
string/titld(45),commno(10),aosno(22)
$$_______________________________________________
    TEXT/'Enter Drawing Number',aosno,rsp
    JUMP/trm:,trm:,,,rsp
    call/'_upr_case',aosno
    ASATT/PART,'DWGSIZ',aosno
$$
    TEXT/'Enter AOS Part Title',titld,rsp
    JUMP/trm:,trm:,,,rsp
    call/'_upr_case',titld
    ASATT/PART,'TITLE1',titld
$$
     commno = SUBSTR(&PNAME,1,8)
     ASATT/PART,'DWG_NO',commno
$$_____________________________________________________
trm:
halt


The call is to a subroutine named _upr_case.grs. Here is the subroutine:

STRING/STNG1,STNG2(80)
NUMBER/N,str,lgth,loc
$$
     STNG2=&NULSTR
$$
     if/stng1==&nulstr,return
     lgth=lenf(stng1)
     loc=1
     str=1
$$_________________________________________________
$$      Check for "$" in string
top: loc=fndstr(stng1,'$',loc) $$ find control character "$"
     if/loc==0,loc=lgth        $$ no "$" character found
        do/loop1:,i,str,loc
           N=ASCII(STNG1,I)
           IF/N<97,N=N+32
           STNG2=STNG2+CHRSTR(N-32)
        loop1:
     if/loc<lgth,N=ASCII(STNG1,loc+1)    $$ get control character
     if/loc<lgth,STNG2=STNG2+chrstr(N)   $$ append it to string
     loc=loc+2                           $$ jump over cntrl char.
     str=loc                             $$ reset start position
     if/loc<lgth,jump/top:               $$ if not end, continue
$$________________________________________________
trm:
     STNG1=STNG2
     RETURN

"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: BOM & Attributes.....

(OP)
Thanks for the reply!
Where is the call to this program made from? Do you run
it from inside UG off of a Menu input or keystroke? Is it run from a batch utility externally?

Oh yeah while I'm on this subject... Is it possible to
assign macros to keystrokes?... and is there a list of Hot Keys for UG I could use to help speed things up?

TIA Dave

RE: BOM & Attributes.....

GRIP must be compiled before you can run it. You need to have both a development and execute license.

File - UG/Open - GRIP will run it internally to UG.

Yes, you can assign macros to user defined menu/button.

UG defined keys are in the ugii_env.dat file, I think.

"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: BOM & Attributes.....


I have never compiled a grip before, but am trying to learn. When I ran the compile, and I got these errors:

PROGRAM : _upr_Case

       1  STRING/STNG1,STNG2(80)
                   *
Error no. 24 in line no. 1: Missing dimension.
       2  NUMBER/N,str,lgth,loc
       3  $$
       4       STNG2=&NULSTR
       5  $$
       6       if/stng1==&nulstr,return
       7       lgth=lenf(stng1)
       8       loc=1
       9       str=1
      10  $$_________________________________________________
      11  $$      Check for "$" in string
      12  top: loc=fndstr(stng1,'$',loc) $$ find control character "$"
      13       if/loc==0,loc=lgth        $$ no "$" character found
      14          do/loop1:,i,str,loc
      15             N=ASCII(STNG1,I)
      16             IF/N<97,N=N+32
      17             STNG2=STNG2+CHRSTR(N-32)
      18          loop1:
      19       if/loc<lgth,N=ASCII(STNG1,loc+1)    $$ get control character
      20       if/loc<lgth,STNG2=STNG2+chrstr(N)   $$ append it to string
      21       loc=loc+2                           $$ jump over cntrl char.
      22       str=loc                             $$ reset start position
      23       if/loc<lgth,jump/top:               $$ if not end, continue
      24  $$________________________________________________
      25  trm:
      26       STNG1=STNG2
      27       RETURN
Error no. 53 in line no. 4: Attempt to assign a value to a non-variable.
Error no. 84 in line no. 6: Invalid relational operator.
Error no. 70 LENF   at argument no. 1 in line no. 7: Invalid field.
Error no. 70 FNDSTR at argument no. 1 in line no. 12: Invalid field.
Error no. 70 ASCII  at argument no. 1 in line no. 15: Invalid field.
Error no. 59 in line no. 17: Illegal use of addition or concatenation.
Error no. 70 ASCII  at argument no. 1 in line no. 19: Invalid field.
Error no. 59 in line no. 20: Illegal use of addition or concatenation.
Error no. 77 in line no. 27: RETURN appears in the main program.
Error no. 91 in line no. 27: Missing HALT in the main program.

NAME      TYPE          ADDR              DIM
N         NUMBER               0
STR       NUMBER               2
LGTH      NUMBER               4
LOC       NUMBER               6
STNG2     NUMBER               8
STNG1     NUMBER              10
TOP       LABEL               39
LOOP1     LABEL              146
I         NUMBER              15
TRM       LABEL              247

11 ERRORS, PROGRAM = 259, DATA = 23
=====================================================================

Is there something obvious I did wrong? Thanks for your help!

RE: BOM & Attributes.....

The code snippet you are compiling is a subroutine, it must start with

CODE

PROC[/dummy argument list]
.
Where 'dummy argument list' is what you are passing into the subroutine. Add

CODE

proc/STNG1
as your first statement and it should take care of the errors.

RE: BOM & Attributes.....

Sweet! It compiled! But why did it become a .gri instead of a .grx? Can I just rename the file extension? I admit, I tried that, and when I run the grip (in NX2), I get this error:

Error 11 at line 9 in .
Internal error: memory access violation
CONTINUE          TERMINATE

Should I give up and simply assign part attributes the old-fashioned way?
Thanks for your help!

RE: BOM & Attributes.....

Kirsten,
   As a sub-routine (easily identified by the underscore as the first character of the file name "_upr_Case") there is no .grx file generated.  This file is dependent on the main routine to run (in this case, the first code example given by looslib). Compile the subroutine first, but don't try to link it (option 3 on GRADE).  Then compile the main routine and after the main is successfully compiled, you can then link the main and sub-routine (option 3 on GRADE).  At this point a .grx file is generated for the main, which internally calls the sub-routine when needed.  Hope this helps...

SS

RE: BOM & Attributes.....

Just for clarification it should be noted that UG doesn't care what the file is named (the leading underscore is for us humans only). UG knows its a subroutine when it starts with PROC/'list' and ends with the RETURN statement. A 'main routine' will usually start with variable declarations and always end with the HALT statement.

RE: BOM & Attributes.....

It works! Thanks so much!

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