Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
My requirement is something like below in the drawing:
IF PTC_WM_LIFECYCLE_STATE == "Prototype Released"
PART_NUMBER = PART_NUMBER "X"
ENDIF
Ex: If state = Prototype Released then Part number is 12345678X
Else 12345678
Iam not able to make this work.
Is this possible? Anybody to help me?
Solved! Go to Solution.
Every regen recalculates the relations, so the extra 'X' will get added.
Try this syntax:
IF PTC_WM_LIFECYCLE_STATE == "Prototype Released"
New_part_number = Part_number +'X'
else
new_part_number = Part_number
endif
Now I tried the below:
IF PTC_WM_LIFECYCLE_STATE == "Prototype Released"
PART_NUMBER = PART_NUMBER + "X"
ENDIF
Now the funny thing is every time the drawing or model regenerates it adds one X at the end of part number.
Now my part number looks like 12345678XXXXXXXXXXXXX
Perhaps try 'if it is prototype released, and the part number does not end in X, then add X'? As I recall, you use string length and extract to check 'ends in X'
The problem is Iam not able to build a working syntax....
How do I use string length in relations?
Ben's approach will also remove the X if the state is no longer prototype released. If this is desired, use that. If you want to flag but not unflag, I had originally been suggesting
if (extract(part_number, string_length(part_number), 1) != "X")
but looking at the dialog to find the precise syntax, I noticed
if (string_ends(part_number, "X"))
which is easier to read.
The part number should have X only for Proto state. for rest of the state its just the part number.
I will try your suggestion too.
Thank You.
Every regen recalculates the relations, so the extra 'X' will get added.
Try this syntax:
IF PTC_WM_LIFECYCLE_STATE == "Prototype Released"
New_part_number = Part_number +'X'
else
new_part_number = Part_number
endif
Thanks Ben. You got it.
I just changed this to :
IF PTC_WM_LIFECYCLE_STATE == "Prototype Released"
part_number = New_part_number +'X'
else
part_number = New_part_number
endif
This works for me.
Thanks for your time.