Skip to main content
1-Visitor
May 19, 2014
Solved

Working with Relations

  • May 19, 2014
  • 11 replies
  • 5912 views

I am wondering if there is a way to use map keys to apply a relation to the part, and allow it so when you hit the map key more then once the relation isnt duplicated. I got this to work to apply a relation to a part with a map key, but if I hit the map key more then once it duplicates the relation, im not sure if there is a "if" statement i have to provide or not.

 

Thanks!

 

Brock


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Best answer by psobejko

Hi Brock,

I've thought of two solutions:

1) If your old parts do not have any relations to them, then you could record your mapkey to clear any relations.

That is, record at the beginning of your mapkey the Relations dialog box menu-bar commands Edit->select all and Edit->Delete, then type in your boiler-plate relations. This way you will not duplicate your template relations...

2) Another way is to use the "Pause" key during the macro-recording:

Start recording your mapkey.

Open the Relations dialog box.

Press the "Pause key" in the Record Mapkey dialog box.

Write into the prompt box a message that prompts the user to make a choice. For example:

Review the part's relations.

If you want to add the standard relations to this part, press "Resume"

If they are already there, press "Cancel"

This will give them a chance to cancel and avoid duplicating your template relations.

11 replies

1-Visitor
May 19, 2014

Since all a mapkey does is replay a series of recorded commands, I don't see how it could be programed to only work once while in a given model. So if you create a mapkey to record the creation of a set of relations, its going to redo those recorded steps every time you enter the mapkey. Which will give you the same block of relations multiple times.

1-Visitor
May 20, 2014

I guess duplicating the relations is not logical through mapkey, isntit?

24-Ruby III
May 20, 2014

Brock,

do you use Creo Parametric 2.0 ?

Please can you upload your mapkey ?

Martin Hanak

bwudtke1-VisitorAuthor
1-Visitor
May 20, 2014

mapkey $F2 @MAPKEY_LABELrelation-set;~ Command `ProCmdMmRels`

mapkey(continued) ~ Arm `relation_dlg` `RelText`;\

mapkey(continued) ~ Update `relation_dlg` `RelText` 1 1188 1329 1 `\n\nSMT_DFLT_BEND_RADIUS \

mapkey(continued) =material_param(\"RADIUS\")\nSMT_THICKNESS=material_param(\"THICKNESS\")\nMA\

mapkey(continued) TERIAL=material_param(\"PTC_MATERIAL_DESCRIPTION\")`;\

mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;~ Command `ProCmdRegenPart`;

2-Explorer
May 21, 2014

Hello,

don´t know your relation. My idea about macro, that create a relation only ones, during second repeat it will appeares a message that tells you: "Your relation CAN be already included".

Creating a macro:

1. create a parameter that is included in your relation (presence of this parameter affect if your macro can can run to the end or not)

2. write your relation

Pasting a relation:

First past is correct ---> parameter is created and relation will be past

Second past is can be done ---> because parameter already exist and macro can´t run to the end ---> relation will not be duplicated.

Macro exapmle:

mapkey hh ~ Activate `main_dlg_cur` `page_Model_control_btn` 1;\

mapkey(continued) ~ Command `ProCmdMmRels` ;~ Activate `relation_dlg` `CBLocalParams` 1;\

mapkey(continued) ~ Activate `relation_dlg` `ParamsPHLay.TBAddParam`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 5111918 `N`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `n`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 5570677 `U`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `nu`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 5046381 `M`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `num`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 4325474 `B`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `numb`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 4522085 `E`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `numbe`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 5374066 `R`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `number`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 23003231 `Shift+_`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `number_`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 5177455 `O`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `number_o`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 5111918 `N`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `number_on`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 4259937 `A`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `number_ona`;\

mapkey(continued) ~ Input `relation_dlg` `ParamsPHLay.ParTable_INPUT` `number_one`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `number_one`;\

mapkey(continued) ~ FocusIn `relation_dlg` `ParamsPHLay.ParTable`;\

mapkey(continued) ~ Arm `relation_dlg` `ParamsPHLay.ParTable` 2 `new_added_row` `value`;\

mapkey(continued) ~ Disarm `relation_dlg` `ParamsPHLay.ParTable` 2 `new_added_row` `value`;\

mapkey(continued) ~ Select `relation_dlg` `ParamsPHLay.ParTable` 2 `new_added_row` `value`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 540344373 `5`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `5`;\

mapkey(continued) ~ Key `relation_dlg` `ParamsPHLay.ParTable` 540344373 `5`;\

mapkey(continued) ~ Update `relation_dlg` `ParamsPHLay.ParTable_INPUT` `55`;\

mapkey(continued) ~ Arm `relation_dlg` `RelText`;\

mapkey(continued) ~ Update `relation_dlg` `RelText` 1 0 18 1 `relation=number_one`;\

mapkey(continued) ~ Activate `relation_dlg` `TBVerify`;~ Activate `UI Message Dialog` `ok`;\

mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;

---------- END OF EXAMPLE

2-Explorer
May 21, 2014

In thise case existence of parameter NUMBER_ONE substitute a condition IF.

IF parameter NUMBER_ONE doesn´t exist ---> run a macro.

IF parameter NUMBER_ONE exists ---> shows a message about parameter duplication.