Skip to main content
10-Marble
September 4, 2025
Solved

Using a Creo UDF with Pro/PROGRAM and Reading in Values from a text file

  • September 4, 2025
  • 1 reply
  • 967 views

I am using Creo Parametric Release 7.0 and Datecode7.0.8.0

Basically I’m trying to learn how to create a hole feature UDF with pro program embedded in it where pro program would be prompting user to read values from a text file which would create a different size hole each time the UDF was placed. If I had a part model that had 3 different size tapped holes, could I place the same UDF 3 times but each time read the text file (modified with new values) to create a different size hole (8-32, ¼-20, etc.) Or is this not what Pro Program was intended to do?

Best answer by ptc-2790516

Am pursuing a different technology as I'm starting to think pro/program may not be the solution for the task I presented.

1 reply

tbraxton
22-Sapphire II
22-Sapphire II
September 5, 2025

Pro/Program can read values from text (.txt) files. 

 

Pro/Program input section example to read two parameters a string and number.

INPUT

STRING1  STRING

NUMBER1  NUMBER

END INPUT

 

Create text files defining the values for these parameters for all variants of the UDF required and save them with unique filenames.

STRING1 = "any string"

NUMBER1 = 1.23

 

Upon regeneration of the model in Pro/Program you will get a prompt for where to obtain values inside the INPUT statement of your model.

The user must then do the following:

Select Read File option and input the name of the text file to get the required parameters.

10-Marble
September 5, 2025

Hello,

This is what I tried without success.

upload_-aW1hZ2UwMDEucG5n-2689495804603592827..png

tbraxton
22-Sapphire II
22-Sapphire II
September 5, 2025

Standard hole features are driven by .hol tables. The feature parameters of these features when added to a Creo model are driven by the contents of the hole table.

 

The issue is that when reading in the text file you are establishing values of model parameters. You can confirm this by opening the parameter UI and you should see the data from the text file in the window.

 

The tapped hole feature used in the UDF creation has variable values within feature parameters. The text file is not understood within program to define feature parameters driving the tapped hole. You would need to figure out how to use the text file to define feature parameters. I am not able to offer an easy solution for this at this time, I suspect it is not possible using available Creo functionality. It probably would require programming via one of the APIs.

 

For tapped holes your planned use of the UDF does not make sense to me in the context of improved productivity. I may not understand exactly how you intend to use this. If your intention is to enable the variation of all of the feature parameters shown in your slide for the UDF hole feature, then you would be better served by using hole tables to vary the holes rather than model parameters. I do not think Pro/Program is able to read hole tables.

 

If were to explain in detail the problem and desired solution within your workflow that prompted your original question, then some other ideas may come to light to automate things.