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

Importing .txt file for parameter list

lockarde
5-Regular Member

Importing .txt file for parameter list

Recently I've created a parameter set for selecting a material from a drop down.  This list drives relations used for grabbing dimensions for an auto-bom table.  I'm having trouble importing this list via .txt file, and I'm wondering if there needs to be a specific syntax for the strings int he .txt file?  This list is pretty simple:

"1X4"

"2X4"

"2'' FOAM"

etc.

 

I have been using a mapkey that creates the parameter, and then adds each material, line by line.  As you can imagine, this is pretty tedious to update.. 

 

When I try to go into the parameter and right click in the list window, select import, and select the .txt file, nothing happens.  Any thoughts?

9 REPLIES 9

The typical syntax for a text file used to create parameters from a text file would be:

 

parameter_name_1 = whatever
parameter_name_2 = foo
parameter_name_3 = bar

 

If you are looking to automate the setting the values of multiple parameters in a model then Pro/Program may offer the solution. You can define the parameters in the input section. With this defined, upon regeneration of the model you will be prompted for the source used to assign values to the parameters. One of the options will be from file which will use a previously created text file to define the values.

Pro/Program examplePro/Program example

 

lockarde
5-Regular Member
(To:tbraxton)

Thanks for the prompt reply @tbraxton! I formatted my list as you described and still get nada.  Do I need " " because it's a list of strings? Side note: I also tried to export the full list I had created to try and discern the format, and that exported list comes out as a blank csv.  Apologies if I'm being dense, still digesting my first cup of coffee this morning..

I suspect I am not understanding exactly what you are attempting to do. I gather you want to define multiple parameters in a part by importing a file. See my remarks in my original response about Pro/Program.

 

One option is to paste the text file contents into the relations definition UI which will create the parameters. You should then delete the relations made from the pasted data once the parameters are defined. You can then export the parameters in xml format for use in importing into other models. When defining strings in the relations UI you will need to use double quote marks as shown here.

 

parameter_1="string value"

 

In my example above for the 3 string parameters, this is what the xml file syntax looks like. An xml file may work out better for what you are trying to do. You should be able to use this as a template to generate an xml file in a text editor to define a list of string parameters.

XML file syntaxXML file syntax

 

 

 

 

lockarde
5-Regular Member
(To:tbraxton)

@tbraxton Yup, some context might be necessary - and I'm probably going about this bassakwards.  I have created an auto-bom that pulls a Dimension parameter from each part.  I design crates, so almost all of the parts I model are rectangles, so all I pull is length and width dims.  The material list is used to create the string for the dimensions so they are in the format desired; i.e (1X4) X 34-1/2, (3/8) X 56-1/4 X 23-1/4 etc.  So, I saved mapkeys that import the relations (attached) to create the dimensions parameter, and the restricted values parameter list MF_MATERIAL which I've added to my model tree (see below).  Now, the only way I was able to create the list seen below is to copy an existing parameter that had a list of values, and then edit the definition.  Here's where the tedious mapkey bit comes in, because I was recording each edit, character by character, line by line 😕 ..  So I'd like to cut out all that tedious mapkey stuff, and just create the parameter, and import a list of values. Like I said, probably bassakwards....

Snag_540f2a.png

Looks like a use case for a restricted value parameter. This link should get you there, it is a bit of work to set it all up but straightforward. I am not sure this config option is detailed in the link but it is relevant if you are going to implement this. Change the path to match your file.

 

restricted_val_definition D:\ProE Standards\Start Creo4\rest_parameters.txt

 

 

https://www.ptc.com/en/support/article/CS51011?language=en&posno=1&q=restricted%20parameter&source=s... 

lockarde
5-Regular Member
(To:tbraxton)

@tbraxton I was kinda hoping you weren't going to point me this way lol  restricted_val_definition is something that's pushed by my company, and I don't think they'd change it for little ol me 😞  But, I will certainly ask and see what's possible.  Thank you for your time and help!

Here is what I get in a txt file:

kdirth_0-1631537867499.png

I believe you are missing the definition of the parameter columns.

 

Here is what I get in a csv file:

kdirth_1-1631537950701.png

Each column separated by a comma.


There is always more to learn in Creo.
lockarde
5-Regular Member
(To:kdirth)

Thanks @kdirth !  Does the information you provided apply to a restricted values list parameter?  I'm trying to create a drop-down list of values like in the image below:

Snag_5b15b0.png

Here is one that I have that is restricted:

kdirth_0-1631539584264.png

 

The restriction comes from windchill.  The value input in the model would need to exactly match one of the acceptable values in windchill.  I have not seen a dropdown list in the model parameters.  In our system, adding a value to a column in the windchill attributes adds the parameter to the model.

 


There is always more to learn in Creo.
Announcements