Skip to main content
May 16, 2017 9:50 AM UTC
Solved

Relation in Drawing

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?

BenLoosliAnswer
May 16, 2017 1:43 PM UTC

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

7 replies

May 16, 2017 10:20 AM UTC

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

May 16, 2017 12:37 PM UTC

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'

May 16, 2017 12:45 PM UTC

The problem is Iam not able to build a working syntax....

How do I use string length in relations?