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
Hello All,
We have about 30 parameters and of those 30 there are about 12 that need to be manually populated. Is there a way to populate those parameters via a text file? Is this something that can only be done in toolkit or is there some other way?
Thanks,
John
John,
You can use toolkit or ModelCHECK to add the parameters.
Maresh has the correct answer.
Personally, I feel that ModelCHECK is the easier to get set up and running. (Oh, and the ModelCHECK config files are really just text files with alternate extensions.
You're right, ModelCHECK batch is a good way to automate the creation of parameters in one or more models. But if the application is a configurator where the user just wants to change 12 parameters to see the resulting design, then Pro/PROGRAM could be a better approach. So the correct answer could vary depending on the application.
Hi,
in Creo Parametric 2.0, add the following option at the end of config.pro file
new_parameter_ui no
Open part, activate Tools tab and click Parameters button. Old menus appears.
These old menus enable you to define mapkey, which creates additional parameters in your model.
In case that you need to modify parameter values, you can use Modify command.
Martin Hanak
Without Toolkit, you could use Pro/PROGRAM. Prompt the user for the parameters values in Pro/PROGRAM using the INPUT section.
When you regenerate you are prompted for the inputs. You don't have to type these in manually. Instead you can read the values in from a file.
You could write a mapkey to regenerate, and read the parameters from file automatically.
You could also automate reading in the parameters with JLink or weblink. (No toolkit license is required for weblink and jlink.) Christopher Lewis' book on WebLink is a useful resource: http://www.lulu.com/shop/search.ep?contributorId=422888
A much simpler way is: save a text file with the parameters and their value, something like:
Parameter1="value1"
Parameter2="value2"
Parameter3="value3"
Then save a mapkey loading this text file into relations
1 - open relations editor
2 - menu file -> import relations...
Two notes:
1 - If you don't want this to stay in relations, you can also while recording the mapkey re-enter the relations Gui and do "select all" -> "delete".
The relations will be cleaned but the parameters will remain.
2 - I tend to use this in the "post-regeneration" relations to avoid erasing the existing relations.
Atached is a example mapey that imports a text file called parameters.txt unto relations editor.
Jose
This will, as you hinted at in your notes, not simply add these relations, but will replace your existing relations with the imported ones. It's a handy method if your relations are empty, but not real useful if you have relations in your part already.
We have default relations in both the Initial and Post Regeneration sections in our start parts, so we cannot sue this method.
I would try a mapkey that saved the current relations to a file, import the 'parameters.txt,' do the delete-all, then re-import the original relations.
Creating parameters in the model
1. Go to Tools/ Program
2. Click on Edit Design
3. A txt-file will open. Parameters can be added as follows (yellow highlighted box):
4. Save the file after the changes and exit it
5. Answer the question if you want to incorporate the changes into your model with YES
6. Click on Done/Return
Updating parameters in the model
1. Click on the normal Regenerate button in Standard mode
2. ProE will ask you how you would like to continue
a. Click on Current Vals if you want to continue with the current values in the parameter set
b. Click on Enter if you would like to change the values manually
c. Click on Read File to read a new txt-file with new parameter values
3. If you clicked on Read File you have to paste the path of the txt-file into the empty box Tip: holding SHIFT and right click on txt-file will enable a new option in order to directly copy the file path
4. Make sure that the directory does not include quotation marks
5. Click Accept
This thread makes me think that there is room for improvement in the OOTB UI. Why can't one use a text file or spread sheet to load parameter values in the parameter dialog? Instead this thread suggests many work a rounds for something that has a valid use case.
Because there are millions of valid use cases. If the activity can be done with existing approaches there is little value in making the software more complex to make an infrequent task simpler. More complex = not writing new features, longer compiles, more code review, more test cases, more input validation requirements, more regression testing.
Most places will set up template files to have all their desired settings so there is no need to bulk-load parameters. Even with bulk loading someone will still have to go one-by-one to change the values of the parameters. Usually this process is done with a mapkey that adds each parameter and then prompts the user for the appropriate value.
OK, this can be automated editing a mapkey, the problem I found was to know if some of the parameters already existed in the model. This would require "modify" instead of "create", so I decided to first delete it and then create it.
here is the mapkey:
mapkey LP @MAPKEY_NAMEload parameters;~ Command `ProCmdMmParams`
mapkey(continued) #DELETE;#PARAMETER1;#DONE;#CREATE;#STRING;PARAMETER1;VALUE1
mapkey(continued) #DELETE;#PARAMETER2;#DONE;#CREATE;#STRING;PARAMETER2;VALUE2
mapkey(continued) #DELETE;#PARAMETER3;#DONE;#CREATE;#STRING;PARAMETER3;VALUE3
mapkey(continued) #DELETE;#PARAMETER4;#DONE;#CREATE;#STRING;PARAMETER4;VALUE4
mapkey(continued) #DONE/RETURN;#DONE/RETURN;
just edit the text to your own values, keep the first and last line unchanged. It's in red what you should change.
Save it in config.pro and reload it and you are ready to go.
This macro only works if you add the following option to your config.pro like MartinHanak suggested:
new_parameter_ui no
And use the text from atached file not the text from post, when I paste the mapkeys here smileys appear everywhere...
Jose
Hello Jose,
If you delete the parameter and then recreate it, don’t you have
to define the property type before you input the value?
John
Yes, you are correct,
Where it says "#STRING" replace with the correct type, options:
#INTEGER;
#REAL NUMBER;
#STRING;
#YES NO;
#NOTE;
Jose
Sorry about all the damn faces in the my reply. I don't know how to get rid of them. Anyone knows how I'd be grateful.
==========
One of our groups has a toolkit app to do this but I think as others have said it’s easy enough to do with mapkeys.
First thing I would do is have a config file that contains a mapkey for modifying the parameters.
This should be someplace in the users area.
The mapkey in the system config would look something like this:
Mapkey .rupm @MAPKEY_NAMERun User Parameter Mapkey;
@MAPKEY_LABLERun User Parameter Mapkey; %.lupc; %.mpl;
The first mapkey it’s calling will load the users config containing their mapkey. That config should reside someplace in the users area so they can easily edit it.
This first mapkey .rupm calls exists in the system config. The path shown in this mapkey should change to the users area.
mapkey .lupc
@MAPKEY_NAMELoad User Parameter Config;\
@MAPKEY_LABELSLoad Param Config;\
~ Command `ProCmdRibbonOptionsDlg`
~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1
`ConfigLayout`;\
~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
~ Update `file_open` `Inputname`\
`P:\\lib_common\\mapkey_configs\\mod_u_parm.pro`;\
~ Command `ProFileSelPushOpen@context_dlg_open_cmd`
~ Activate `ribbon_options_dialog` `OkPshBtn`;\
~ FocusIn `UITools Msg Dialog Future` `no`;\
~ Activate `UITools Msg Dialog Future` `no`;
After loading the config the mapkey above would call the
name of the mapkey that was just loaded.
Which looks something like this: The user would edit this
where the hi-lited dashes are for what they want the parameters modified to.
mapkey .mpl @MAPKEY_NAMEModify Parameter List;\
@MAPKEY_LABELModify Parameter List;\
%ou;~
Activate `main_dlg_cur` `page_Tools_control_btn` 1;\
~ Command `ProCmdMmParams`
#MODIFY;#CONFIRM;#DRAWN;-
#MODIFY;#CONFIRM;#DESIGNED;-
#MODIFY;#CONFIRM;#CHECKED;-
#MODIFY;#CONFIRM;#APPROVED;-
#DONE SEL;#DONE/RETURN;#DONE/RETURN;%nu;
Take note that this mapkey calls two other mapkeys. These
load a config that changes the parameter UI to the old style, makes the changes,
and then load a config that sets the UI back to the new style.
!=========================================================
!== Load Parameter/Relations UI config files
!=========================================================
mapkey ou
@MAPKEY_NAMELoad Old Parameter/Relation UI;@MAPKEY_LABELOld UI;\
~ Command `ProCmdRibbonOptionsDlg`
~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1`ConfigLayout`;\
~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
~ Update `file_open` `Inputname`\
`P:\\lib_common\\mapkey_configs\\new_ui_no.pro`
~ Command `ProFileSelPushOpen@context_dlg_open_cmd`
~ Activate `ribbon_options_dialog` `OkPshBtn`;\
~ FocusIn `UITools Msg Dialog Future` `no`;\
~ Activate `UITools Msg Dialog Future` `no`;
mapkey nu
@MAPKEY_NAMELoad New Parameter/Relation UI;@MAPKEY_LABELNew UI;\
~ Command `ProCmdRibbonOptionsDlg`
~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1`ConfigLayout`;\
~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
~ Update `file_open` `Inputname`\
`P:\\lib_common\\mapkey_configs\\new_ui_yes.pro`
~ Command `ProFileSelPushOpen@context_dlg_open_cmd`
~ Activate `ribbon_options_dialog` `OkPshBtn`;\
~ FocusIn `UITools Msg Dialog Future` `no`;\
~ Activate `UITools Msg Dialog Future` `no`;
You could do the same for Adding, deleting, or designating
parameters:
mapkey .aup @MAPKEY_NAMEAdd User Parameter;@MAPKEY_LABELAdd User Parameters;\
%ou;~
Activate `main_dlg_cur` `page_Tools_control_btn` 1;\
~ Command `ProCmdMmParams`
#CREATE;#CONFIRM;#STRING;DESIGNED;-;\
#CREATE;#CONFIRM;#STRING;MATERIAL;-;\
#CREATE;#CONFIRM;#STRING;PART_NO;-;\
#DONE SEL;#DONE/RETURN;#DONE/RETURN;%nu;
mapkey .del @MAPKEY_NAMEDelete NWC Parameters;\
@MAPKEY_LABELDelete NWC Parameters;%ou
~ Activate `main_dlg_cur` `page_Tools_control_btn` 1;\
~ Command `ProCmdMmParams`
#DELETE;\
#DESIGNED;\
#MATERIAL;\
#PART_NO;\
#DONE SEL;#DONE/RETURN;#DONE/RETURN;%nu;
mapkey .dsgnt @MAPKEY_NAMEDesignate Parameters;\
@MAPKEY_LABELDesignate Parameters;%ou
~ Activate `main_dlg_cur` `page_Tools_control_btn` 1;\
~ Command `ProCmdMmParams`
#DESIGNATE;#PARAMETERS;\
#DESIGNED;\
#MATERIAL;\
#PART_NO;\
#DONE SEL;#DONE/RETURN;#DONE/RETURN;%nu;
If you want to insert code (e.g. mapkey, ...) in a post, you should click Use Advanced Editor, then click on the '>>' icon and use the appropriate Syntax Highlighting. For mapkeys, I have used the Plain option. Using this option will avoid the emoticon substitutions and it will nicely format your code with line numbers.
Example
mapkey dl @MAPKEY_LABELDimension Layer;~ Command `ProCmdLayer_NewLay` ;\
mapkey(continued) ~ Input `newlayerprops` `LayerNameInput` `d`;\
mapkey(continued) ~ Input `newlayerprops` `LayerNameInput` `di`;\
mapkey(continued) ~ Input `newlayerprops` `LayerNameInput` `dim`;\
mapkey(continued) ~ Update `newlayerprops` `LayerNameInput` `dim`;\
mapkey(continued) ~ Select `newlayerprops` `PropTab` 1 `RulesDefsettingsLay`;\
mapkey(continued) ~ FocusOut `newlayerprops` `LayerNameInput`;\
mapkey(continued) ~ Activate `newlayerprops` `EditRulesBtn`;\
mapkey(continued) ~ Open `selspecdlg0` `SelOptionRadio`;~ Close `selspecdlg0` `SelOptionRadio`;\
mapkey(continued) ~ Select `selspecdlg0` `SelOptionRadio` 1 `Dimension`;\
mapkey(continued) ~ Open `selspecdlg0` `LookByOptionMenu`;\
mapkey(continued) ~ Close `selspecdlg0` `LookByOptionMenu`;\
mapkey(continued) ~ Select `selspecdlg0` `LookByOptionMenu` 1 `Dimension`;\
mapkey(continued) ~ Activate `selspecdlg0` `AddRuleBtn`;\
mapkey(continued) ~ Activate `selspecdlg0` `SelectButton`;\
mapkey(continued) ~ Select `newlayerprops` `RuleOptionsCasc`;\
mapkey(continued) ~ Close `newlayerprops` `RuleOptionsCasc`;\
mapkey(continued) ~ Activate `newlayerprops` `AssocRulesChk` 1;\
mapkey(continued) ~ Activate `newlayerprops` `OkBtn`;
Just testing....
mapkey LP @MAPKEY_NAMEload parameters;~ Command `ProCmdMmParams` ;\
mapkey(continued) #DELETE;#PARAMETER1;#DONE;#CREATE;#STRING;PARAMETER1;VALUE1;\
mapkey(continued) #DELETE;#PARAMETER2;#DONE;#CREATE;#STRING;PARAMETER2;VALUE2;\
mapkey(continued) #DELETE;#PARAMETER3;#DONE;#CREATE;#STRING;PARAMETER3;VALUE3;\
mapkey(continued) #DELETE;#PARAMETER4;#DONE;#CREATE;#STRING;PARAMETER4;VALUE4;\
mapkey(continued) #DONE/RETURN;#DONE/RETURN;
it works thanks Mark.
I was running into the same thing. I'd rather shut off emoticons, but the advance editor will work. I think the advanced editor isn't available from the Stream view though.