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 called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Mapkey: set a parameter based on a condition?

rmcboaty
10-Marble

Mapkey: set a parameter based on a condition?

i work primarily with wildfire 3 and creo 3, no windchill.
I have a parameter CONFIRMED = YES_NO, which states if the design has been confirmed by the buyer or not.
If it has been confirmed, that means that i unhide a couple of additional manufacturing-related objects on the drawings (more detailed notes, tables...).
sometimes the customer wants additional changes, which means that i have to set it to NO again after setting it to YES though.
Currently i have to set it by hand, but i wonder if it's possible to make a mapkey to do it? The mapkey would have to look at the current value of the param (yes/no) and set it to the other one.
is it possible to do that? 

i know that's probably possible in weblink, but i'd rather do it with a mapkey (i am allowed to make mapkeys, but mgmt wouldn't understand something else and would berate me for wasting my time...).

ACCEPTED SOLUTION

Accepted Solutions

Hi,

I think defining such mapkey is complicated.

 

Suggestion:

  • set config.pro option ... new_parameter_ui no
  • define mapkey which sets parameter value to YES
  • define mapkey which sets parameter value to NO

To get "toggle" mapkey you have to:

  • write parameter values into file
  • analyze file contents (using some script) to find current parameter value
  • generate config_toggle.pro file containing mapkey setting opposite value
  • loading config_toggle.pro file 
  • launching mapkey setting opposite value

 


Martin Hanák

View solution in original post

6 REPLIES 6

Hi,

I think defining such mapkey is complicated.

 

Suggestion:

  • set config.pro option ... new_parameter_ui no
  • define mapkey which sets parameter value to YES
  • define mapkey which sets parameter value to NO

To get "toggle" mapkey you have to:

  • write parameter values into file
  • analyze file contents (using some script) to find current parameter value
  • generate config_toggle.pro file containing mapkey setting opposite value
  • loading config_toggle.pro file 
  • launching mapkey setting opposite value

 


Martin Hanák

  • define mapkey which sets parameter value to YES
  • define mapkey which sets parameter value to NO

ok i will do this. way simpler and you can see from the drawing in which state it is anyway.

thanks.

TomU
23-Emerald IV
(To:rmcboaty)

Another possibility is to do this in relations and then just use a mapkey to add these relations somewhere, execute them once, and then remove them (assuming they can't be left in place permanently.)

 

Here's an example.  This mapkey ('op') does the following:

  1. Open the post regeneration relations dialog
  2. Save any existing relations to a temporary file
  3. Load the new relations
  4. Verify the new relations.  This will automatically create the parameters if they don't exist, analyze the model, and set the parameter values accordingly.
  5. Reload any previously saved relations (from step 2).

 

mapkey op @MAPKEY_NAMECreate OPERATION, PART_NO, and UNITS Parameters;\
mapkey(continued) @MAPKEY_LABECreate OPERATION, PART_NO, and UNITS Parameters;\
mapkey(continued) ~ Command `ProCmdMmRels` ;~ Command `ProCmdDwgRelations` ;\
mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;\
mapkey(continued) ~ Activate `storage_conflicts` `OK_PushButton`;\
mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;\
mapkey(continued) ~ Command `ProCmdMmRels` ;~ Command `ProCmdDwgRelations` ;\
mapkey(continued) ~ Select `relation_dlg` `PrePostOM` 1 `PostRegen`;\
mapkey(continued) ~ Activate `relation_dlg` `PBExport`;\
mapkey(continued) ~ Activate `file_open` `Current Dir`;\
mapkey(continued) ~ Update `file_open` `Inputname` `backup.txt`;\
mapkey(continued) ~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;\
mapkey(continued) ~ Select `relation_dlg` `MenuBar1` 1 `File`;\
mapkey(continued) ~ Activate `relation_dlg` `PBRead`;\
mapkey(continued) ~ LButtonActivate `file_open` `tb_EMBED_BROWSER_TB_SAB_LAYOUT` 3 308 13 0;\
mapkey(continued) ~ Update `file_open` `opt_EMBED_BROWSER_TB_SAB_LAYOUT` `H:\\Library\\Setup`;\
mapkey(continued) ~ Activate `file_open` `opt_EMBED_BROWSER_TB_SAB_LAYOUT`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `product_parameters.txt`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `product_parameters.txt`;\
mapkey(continued) ~ Activate `relation_dlg` `TBVerify`;~ Activate `UI Message Dialog` `ok`;\
mapkey(continued) ~ Select `relation_dlg` `MenuBar1` 1 `Edit`;\
mapkey(continued) ~ Activate `relation_dlg` `PBSelectAll`;\
mapkey(continued) ~ Select `relation_dlg` `MenuBar1` 1 `Edit`;\
mapkey(continued) ~ Activate `relation_dlg` `PBDelete`;\
mapkey(continued) ~ Update `relation_dlg` `RelText` 0;\
mapkey(continued) ~ Select `relation_dlg` `MenuBar1` 1 `File`;\
mapkey(continued) ~ Activate `relation_dlg` `PBRead`;\
mapkey(continued) ~ Activate `file_open` `Current Dir`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `backup.txt`;\
mapkey(continued) ~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `relation_dlg` `TBVerify`;~ Activate `UI Message Dialog` `ok`;\
mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;

Here's what's in the 'product_parameters.txt' file being loaded in step 3:

/* Initialize OPERATION, PART_NO, and UNITS
OPERATION = ""
PART_NO = ""
UNITS = "INCH"
IF STRING_LENGTH(REL_MODEL_NAME()) > 3
    IF EXTRACT(REL_MODEL_NAME(),STRING_LENGTH(REL_MODEL_NAME())-2,1) == "_"
        OPERATION = EXTRACT(REL_MODEL_NAME(),STRING_LENGTH(REL_MODEL_NAME())-1,2)
        PART_NO = EXTRACT(REL_MODEL_NAME(),1,STRING_LENGTH(REL_MODEL_NAME())-3)
    ENDIF
ENDIF
IF OPERATION == ""
    IF REL_MODEL_TYPE()== "PART"
        OPERATION = "10"
    ENDIF
    IF REL_MODEL_TYPE()== "ASSEMBLY"
        OPERATION = "20" 
    ENDIF
    PART_NO = REL_MODEL_NAME()
ENDIF
IF PART_NO == ""
    PART_NO = REL_MODEL_NAME()
ENDIF

Let me know if you need me to actually make a working example of a parameter toggle based on this approach.

If I understand the problem correctly then Drawing Program may be an easy solution.

You can create a state called "CUSTOMER_CHANGE" to add the required notes, tables, symbols etc. Then a program:

IF PARAMETER=="No"

SET STATE CUSTOMER_CHANGE

ENDIF

where PARAMETER may be whatever your drawing Parameter.

So if the value of CUSTOMER_CHANGE is NO then the note, tables or symbols will appear on the drawing.

If the value is Yes, then those notes, tables or symbols will be erased (hidden) from drawing display.

I think you could handle this with a couple of parameters and a very simple mapkey, if the things I want to do are possible with a mapkey, that is:

Parameters:

"doToggle" a boolean (YES/NO), defaults to NO.

"isConfirmed" another boolean that indicates if the customer has confirmed your stuff

Mapkey:

Sets the doToggle to YES, then calls for a regeneration.

 

Then use relations to make all the other changes you want, and reset the doToggle parameter back to NO.

 

/* First do the toggling.
/*
IF doToggle
  IF isConfirmed
     isConfirmed = NO
  ELSE
    isConfirmed = YES
  ENDIF
doToggle = NO ENDIF /* Now, act on the set state of isConfirmed. /* IF isConfirmed <do the stuff for a confirmed state> ELSE <do the stuff for an unconfirmed state> ENDIF

Hopefully it's possible to do these things in the Drawing mode.

ghansen
12-Amethyst
(To:rmcboaty)

One mapkey ccy to set parameter "=yes" another mapkey ccn to set "=no"??

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags