Removing duplicate relations created by a mapkey
- February 8, 2024
- 2 replies
- 1788 views
I have created a mapkey that users use for updating legacy Creo parts (Creo 6 and earlier). We are now on Creo 9.
The mapkey checks for missing relations and parameters (including restricted) then adds them if they are missing. The issue is that it will duplicate relations that already exist. I put a pause in the mapkey telling them to delete old relations before continuing but we know that doesn't usually work.
I also have Modecheck running looking for the missing relations and errors if they are missing. It tries to add them even if they exist due to the fact that they are in the Post Regeneration relations. The relations that Modelcheck adds appear in the Initial relations. The reason for locating them in the Post Regeneration was that it was overwriting legacy relations located in the Initial relations. It is causing a regeneration issue that Modelcheck flags.
In my mapkey I have relation written to bypass a couple relation (these came from PTC Tech support) and appear to work.
IF EXISTS("REV=PTC_WM_REVISION")==NO
REV=PTC_WM_REVISION
ENDIF
IF EXISTS("Weight=PRO_MP_MASS")==NO
Weight=PRO_MP_MASS
ENDIF
What I would like is for the mapkey to not enter relations again if they already exist.
I have tried using the ‘IF EXISTS’ but not had much luck.

