Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I want to automatically set all components in an assembly named with a certain prefix to "REF" for QTY on a drawing BOM.
In the drawing BOM repeat region, is there a way to extract the first part of a part's DESCRIPTION parameter value and use it to change its entry in the QTY column?
Here is the PTC command line I am using to extract: extract(string, position, length)
Here are the code I am using currently, it doesn't give an error, but it doesn't change the QTY column to "REF" like I need it to:
QTY1=rpt_qty
MEM_PRE=extract(asm_mbr_description,1,4)
IF MEM_PRE=="mem-"
QTY1="REF"
ELSE
QTY1=rpt_qty
ENDIF
Thanks in advance!
Solved! Go to Solution.
Ben,
I got it to work. I deleted all the existing LOCAL PARAMETERS and relations and started over, making sure to verify the relations for errors as they were added and adding LOCAL PARAMETERS if they didn't add automatically below the Relations window. Here is the code:
QTY=rpt_qty
PREFIX=extract(asm_mbr_description,1,4)
IF PREFIX=="DOC-"
QTY="REF"
ENDIF
NOTE: DESCRIPTION is a string parameter in parts/models used in this test.
-Paul
What is your repeat region Quantity column using for its driving parameter?
Do you have QTY1 defined as a local parameter?
Ben,
The repeat region is driven by rpt.rel.QTY1. The DESCRIPTION column is driven by asm.mbr.description.
QTY1 is in the Local Parameters --see attached. Does every parameter used in the relations need to be in the Local Parameters? If so, what is the proper way to add them? I noticed all the Local Parameters that are already there are of type "unknown".
-Paul
Ben,
I got it to work. I deleted all the existing LOCAL PARAMETERS and relations and started over, making sure to verify the relations for errors as they were added and adding LOCAL PARAMETERS if they didn't add automatically below the Relations window. Here is the code:
QTY=rpt_qty
PREFIX=extract(asm_mbr_description,1,4)
IF PREFIX=="DOC-"
QTY="REF"
ENDIF
NOTE: DESCRIPTION is a string parameter in parts/models used in this test.
-Paul