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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Translate the entire conversation x

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

ptc-2790516
4-Participant

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

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?

6 REPLIES 6
tbraxton
22-Sapphire I
(To:ptc-2790516)

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.

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric
ptc-2790516
4-Participant
(To:tbraxton)

Hello,

This is what I tried without success.

upload_-aW1hZ2UwMDEucG5n-2689495804603592827..png

tbraxton
22-Sapphire I
(To:ptc-2790516)

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.

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric
ptc-2790516
4-Participant
(To:tbraxton)

Hi tbraxton,

      I tried the hole table route but there are to many variations of threaded holes in machining. The workpiece material, type of thread (STI, Keensert, etc.), the depth of the hole (blind, through, or blind with no breakout and minimal clearance from the minimum thread depth), and the Csink angle callouts will effect the diameters and depths...variations are in the hundreds. With that said, I need a flexible solution and am trying to not go the API route.

 

I create planning models with machinability built in for less experienced cnc programmers to bring the model into their CAM system with the correct geometry so their time spent is on programming and not looking up charts for threaded hole specs and modifying the design model.

 

With your insight on feature parameters, I tried creating a revolved cut for the minor diameter and chamfer as well as a revolved surface representing a cosmetic thread which simulates a hole feature but doesn't require the hole file or UDF restrictions of a hole feature. I have it to the point where the original features that I built the UDF on regenerates to the values in the file that's read in but the new placements from the UDF retain the values of the original features that I built the UDF on in the beginning (I need the reverse).  I renamed the dimensions on the features before creating the UDF thinking they would carry through on new instances and also defined the var params with the same names of the dimensions when creating the UDF. I feel like I'm close but don't know the UDF/Pro-Program details enough.

 

Thanks for the help

        

Hi tbraxton,

I saw a similar thread called  "UDF with Pro/program on different features based on same UDF" which is what I want but still having issues. First, I can insert the udf with pro-program into the actual reference part to test, regen, prompt to read file and after regenerating, the hole reflects the file read in. If I modify the values in the text file and insert the same udf again, after regenerating, it will take the new values but update the first instance to the new values of the second instance. I even tried to disassociate (as mentioned in the UDF with Pro/program on different features based on same UDF thread) but no success. Second, when I start a new part without the original features that the udf was built from, it does not prompt to read files after regenerating, I thought the udf is supposed to copy the parameters and relations from the reference part into the new part. The first image is the reference part with the features of the udf, the second image is adding an instance after modifying the text file values (still in the reference part). Any help is greatly appreciated.

 

Thanks, ptc-2790516

 

ptc2790516_3-1757611830020.png    ptc2790516_4-1757611852632.png

 

 

 

 

          

 

 

 

ptc-2790516
4-Participant
(To:tbraxton)

I'm trying to create a Creo UDF utilizing family tables to read in a file that assigns values to parameters then relations to assign the new parameter values to dimensions of the feature group in the UDF based on the instance selected from the user.

Is there a way to test for which instance was selected when inserting a UDF with family tables in Pro/Program? Below is what I tried without success.

 

ptc2790516_0-1758128543591.png

Announcements
NEW Creo+ Topics: Real-time Collaboration

Top Tags