I am looking to see if there is a way to create drop down lists for user created parameters.
Example: If you assign multiple material files to a part in Creo you then get a drop down list of those material files.
I want to be able to do this with user/Admin create parameters. Anyone have any ideas?
Thanks in advance.
Andy
Solved! Go to Solution.
You can use a restriction definition file to do that:
First step: Create a new text file, you can copy this text and change it to meet your needs:
ND_ParamDefArr_K01 = {
{ Name = color_1
Type = string
Default = 'blue_new'
Enum = { 'red_new', 'green_new', 'blue_new' }
},
{ Name = color_2
Type = string
..Default = 'white_new'
..! DEFAULT IS WHITE_NEW
..Enum = { 'yellow_new', 'white_new', 'black_new' }
},
!!! ADD MORE RESTRICTED VALUE PARAMS HERE
}
This example has two parameters ("Color_1" and "Color_2") with three items.
Second step: Add this option to your config.pro:
restricted_val_definition c:\Creo_startin\rest_parameters.txt
Change the path to match your file.
Are you asking for a drop down list for specific parameters in the parametr UI?
For example;
Lance
See attached image.
Yes. I want to have a parameter that has a known set of possible answers to have a drop down instead of having users manually typing them in.
You can use a restriction definition file to do that:
First step: Create a new text file, you can copy this text and change it to meet your needs:
ND_ParamDefArr_K01 = {
{ Name = color_1
Type = string
Default = 'blue_new'
Enum = { 'red_new', 'green_new', 'blue_new' }
},
{ Name = color_2
Type = string
..Default = 'white_new'
..! DEFAULT IS WHITE_NEW
..Enum = { 'yellow_new', 'white_new', 'black_new' }
},
!!! ADD MORE RESTRICTED VALUE PARAMS HERE
}
This example has two parameters ("Color_1" and "Color_2") with three items.
Second step: Add this option to your config.pro:
restricted_val_definition c:\Creo_startin\rest_parameters.txt
Change the path to match your file.
I tried doing this and I'm having trouble getting it to work. I am very computer stupid, so I could use some more details about how to make this work.
1. Do I need to create the parameters in the model, or will this create the parameters automatically?
2. Do I have to do anything in Creo to tell it to look at this text file, other then the config.pro option? Meaning, when a parameter with this "name" always have those options when created, or do I have to tell it to use those options?
3. What does the first line of that text mean?
ND_ParamDefArr_K01 = {
If they already exists you have to delet it and create them restrictly.
Jose,
This is what i was looking for. Here is a link to the PTC Site.
https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS121507&posno=5&q=add
James i have gotten this link to work. Follow the directions on the link. If you have further questions let me know.
Thanks again for the help Jose.
Thanks for the link Andy that was really helpful.
It seems not working.
The restricted params file needs to have a LST extension instead of TXT.
The examples come with LST extension, but I changed mine to TXT and works fine.
It´s very easy to damage that files, I believe that is what is happening to you
because has happened to me a lot of times . You have to be very careful editing it.
Check this:
http://communities.ptc.com/message/15294#15294
Jose
Ah, Ok. I remember being told by support that it needs to be a LST file. It's definitely good to know it can be changed to TXT extension, because Creo sometimes generates LST files for other purposes, which is kind of confusing.
Too bad I haven't had a time to play with this, but my guess is that you need to get a check mark in the Restricted column as is missing on following picture.
@Jose, about damaging of files, you're right. PDF files, and propably also the forums mess up with formating of the text, which is propably the cause of the file to fail to load properly. Would you be willing to post an example TXT file that works?
Have you tried the previous links on this thread ?
https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS121507&posno=5&q=add
http://communities.ptc.com/message/15294#15294
Just change the extension to TXT.
Don´t use wordpad for editing this files, notepad is better, or maybe notepad++.
Jose
Is there a way to update the restricted value file and have the parameters update, without having to delete and recreate them? Perhaps a way to read the values from a file each time its loaded?
The restricted params file is read each time you start Creo. If you make changes to the restricted params file, and you are modifying an existing Creo file, you need to go to tools- parameters and update the values in your Creo file. You will then see the latest parameter values.
As Ben mentioned, the restricted parameters file is read during startup, and you can use "tools, parameters, tools, update restriction definition" to force the current model to update it's cached list to agree with the current values in the params file. A couple of things to keep in mind:
I find restricted parameters most useful for custom library/start parts where I want to control the values for one very specific characteristic. This method only requires that I build a customized parameters list while I'm building the model. The rest of the users in the company don't have or need to have any restricted parameters list.
Thanks Ben and Tom! The info you presented will be helpful to me.
One question I have - in order to update a restricted parameter, does one need to have the restricted paramter file read? I have a list of vendors in a dropdown list that is used with a start part to allow the users to select the vendor instead of entering it in manually. Occasionally a new vendor is added, but I am only informed when the user wants to add it to the part that was created with the old list. Would that user need to have the RP file read into session to update the parameter once I have updated the file?
Yes, the file has to be present during startup. If you make changes to the file you have to shut down and relaunch Creo. If you intend to share this with all your users then I'd recommend you set the path to the file to some read-only shared path. That way any time you make changes to the file the users will automatically be reading the latest version the next time they startup.
I planned on keeping the start parts updated, unfortunately, as I stated, users rarely think ahead and have already created the part they need the new vendor info for. But its good to know that I don't have to keep deleting and recreating the parameter each time I update.
You should update any start parts or templates whenever you make changes to the restricted params file so your seed parts are up-to-date.
We use the file for names of people signing off on drawings, so my list changes every few months. After a couple of changes I go in and update the drawing template files so the designers have the latest lists in all new files.
I have all the company configuration, template, and other such files in a limited access folder structure (or at least it will be once I sit down with the IT department.
I am also using the restrictedparams.txt file and it works very nicely. However, I have a cascade parameters effect that I need to manage. Any workaround is much appreciated.
I.E>,
PART_TYPE = A
PART_SUBCLASS :
*A1
*A 2
*A 3
PART_TYPE = B
PART_SUBCLASS :
*B1
*B 2
*B 3
I have a similar need for cascading restricted parameters. This would be GREAT for an enhancement (Hint hint PTC). You can do this in Windchill but not in CREO 4.
There's a way to do this in ModelCHECK check but will take a lot of tricky configuration to make this happen.
This should be an OOTB functionality. Solidwork does this today and a few automations that should be easy to implement.
Not sure if it was just me but I found the above didn't work.
This is my working code;
ND_ParamDefArr_K01 = {
{ Name = left_end
Type = string
Default = 'END_STOP'
Enum = { 'SPLICE', 'END_STOP', 'FSE', 'NONE' }
},
{ Name = RIGHT_END
Type = string
Default = 'END_STOP'
Enum = { 'SPLICE', 'END_STOP', 'FSE', 'NONE' }
}
!!! ADD MORE RESTRICTED VALUE PARAMS HERE, PLACE A , BEHIND THE ABOVE }
}
In my Config.Pro file I have;
restricted_val_definition C:\PTC_CAD_Support\CONFIG_FILES\CREO2\restricted_parameters.lst
As one of the other provided links seem to no longer work, I found this youtube video very helpful: https://www.youtube.com/watch?v=p8_HoUPT_F8
These things haven't changed in forever. There is a whole section in the help documentation on them:
is looks correct to me, just like scripting, you need to make sure you have the match open "{" with the close "}" and commas.
Good luck!
Hi Jose,
I tried to make two parameters with drop down list and modified the config.pro.
Unfortunatelly i cannot get it working.
Please see attached pic.
Thanks in advance
T.
Tomas,
I uploaded my test restriction file list1.lst packed in list1.zip. I tested it in Creo 2.0.
config.pro option
restricted_val_definition D:\users\mh\creo2_parametric\list1.lst
Martin Hanak