cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Working with Relations

bwudtke
10-Marble

Working with Relations

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.
1 ACCEPTED SOLUTION

Accepted Solutions
psobejko
12-Amethyst
(To:bwudtke)

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.

View solution in original post

11 REPLIES 11
JamesBurcham
4-Participant
(To:bwudtke)

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.

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

Brock,

do you use Creo Parametric 2.0 ?

Please can you upload your mapkey ?

Martin Hanak


Martin Hanák

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`;

I use Creo 2.0, the reason i want to do this is for parts that are in our system that are older and want to quickly update them with the standard parameters we have set in our material, which are setting the thickness of our sheet metal, and radius of bends, and material description.

This "relation mapkey works! BUT im not sure if it is a good way to do it because if you hit the map key more then once, it will duplicate the same set of relations in the part. Im looking for a way to not duplicate these relations if i hit the mapkey, or a different solution where my old part could grab these new relations i want from the activated material through a simple compand.

Thank you!

JamesBurcham
4-Participant
(To:bwudtke)

You can do that with a mapkey, just have to be careful to not it hit more then once. For situations like this I just keep the relations saved in notepad and copy and paste them in the models I want to update. There is a little more work this way, but you do eliminate the potential for duplicates.

sali-2
1-Newbie
(To:bwudtke)

Sir i'm not sure if i can help,i use mapkeys to output the CL data,but

What if you use an icon for the mapkey and place it in quick access tool bar for sheet metal module and run it with a single click of mouse instead of keyboard.

and if the last regenerate command you leave for manual so that the mapkey remains in active state,i think the same mapkey can't run again without finishing its 1st instance.

psobejko
12-Amethyst
(To:bwudtke)

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.

Thank you, number "1" solution works well with this, to make sure we have standardized relations with our sheet metal parts!!

Brock

mbonka
15-Moonstone
(To:bwudtke)

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

mbonka
15-Moonstone
(To:mbonka)

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.

Top Tags