User Defined Features (UDFs) are Creo objects that you can create to speed up the creation of common features you use or to give your features more parameters and “smarts” than you would normally have time for since you only need to do it once to use it many times. This is my mostly exhaustive instruction set for Creo UDFs. I have detailed how you can create my two best UDFs so that you can see real world examples of how to make UDFs quickly that can save you lots of time. Each example highlights many of the tricky parts so read both examples even if you aren’t trying to build that UDF exactly.
You notice yourself spending a significant amount of time creating similar features over and over again
Ex. 1 Generic Thread revolves and cosmetic threads.
Ex. 2 Stub Acme revolves, notes, and cosmetic threads (click here for a free Stub Acme Dimensions/Note Calculator I made)
Solution using UDFs:
In Ex 1 I will show you how to create UDFs. In Ex 2 I will show you how to edit UDFs. There are key differences and editing UDFs is particularly bothersome.
Ex. 1 Generic Threads
To create a UDF create a new part or use an existing one. It is usually easier to create a new one because it is better to create references in UDFs that use as little references to non-UDF geometry as possible. If you reference part datums or geometry of other features in a part that are not included in the UDF group of features than when you go to place the UDF in another part you will have to select all those references in the new part even if they could be implied by fewer geometry references. This wastes time when using a UDF.
Create the features of your UDF. Make sure all your UDF feature references are as self-contained as possible. Ie. Instead of the side plane I will reference the edge surface of the cylinder since I need that anyways for my revolve. Instead of the top plane I will use the center axis as that more closely matches my design intent and protects me when trying to add the UDF to parts that don’t meet the current Weatherford standard of having a TOP plane. We could even imply the end surface by making the end point of our chamfer liner vertically constrained over the end point of the ID surface line. However, I do want to be able to choose which end of the ID surface the face of the thread should be on so I do need an end surface reference. The one step that is easy to miss is when setting up the sketch plane. Set the sketch plane to have the FRONT plane and the end surface as references.
For the thread revolve geometry I set it to have a little chamfer for looks and a 3/4 TPF taper to match the most common thread looks. I set the thread to be only 1in long because in UDFs if you have adjustable geometry you want it to be as small as possible in the UDF so you can apply it to the smallest parts possible without having to redefine the feature while you are placing the UDF. It is easier to edit a dimension to be larger after you have placed it than to go through the menus or a failed placement trying to remember which feature needs to be redefined. A ¾ TPF is entered into the revolve taper angle over the diameter directly as atan(.75/12). As I accept that value it asks me if I want to add that formula as a sketch relation.
Feature or sketch level relations of features in the UDF group are added to the part the UDF is placed in as feature or sketch level relations. Part level relations and parameters are not added to the destination part. We will talk more about relations and parameters in Ex 2.
Let’s create a sketch to represent the cosmetic thread for this udf.
Again let’s make sure that only the end surface and the FRONT plane are selected as initial references to setup the sketch plane. We can reference the geometry of the revolve since that is included in the UDF feature group. I keep saying UDF feature group since we will actually group all the features of the UDF at the end. Grouping the UDF features is an important step that keeps the UDF from asking for names for internal references and from asking the user to select references before they place the UDF even though the references don’t exist yet. When the UDF gets placed it is easy to ungroup the features if required. I made the cosmetic thread terminate at the end point of the taper so that you can place this generic thread UDF in a part where the generic thread extends to the full length of the blanking ID without failing. If I would have set the cosmetic thread to be constrained on the flat part of the ID then for parts like I previously mentioned it would error.
I create a sketch/construction level centerline in order to not add a new datum to the destination part. Then I mirror the sketched lines over the datum and with all lines selected set the line style property to hidden as this shows up nicely in the PDFs in Windchill.
Then I will accept the sketch, select my features I want to be placed with my UDF and group them.
Now we are done creating the features and it is time to actually create the UDF. The UDF Library command is how you both create and edit UDFs. The UDF command is just to place a UDF.
From the popup old school style menu you can create new UDFs or edit existing ones.
Set a name that works with Creo’s crazy name restrictions. The name you enter here will be used as the reference part name + _gp.
Always select Stand Alone unless you never want to be able to edit the UDF.
Here again always choose yes to create a reference part unless you don’t want to be able to edit it. You could technically edit a UDF based on a production part. However, if you make any changes to the features of the part the UDF is based on without first removing them from the UDF, when you go to edit the UDF the link between the part and the UDF will be broken. You will no longer be able to set or update the features of the UDF based on the part.
When you click yes to include reference part later it copies your current part and names it the UDF name + _gp. I believe the _gp part is the same as a regular part. Then the UDF menu pops up. These are the features you have to create and edit UDFs. It is setup to complete the UDF top down in the menu even though you can jump to other steps at different times if you don’t plan on using all the functionality.
By default you can start clicking on features to add. Since we grouped all our features we can just click on the group to select everything we need and then click done in the SELECT FEAT menu and then in the UDF FEATS menu.
Now if you have setup your features properly it will only ask you for names for the FRONT plane, the centre axis, the ID surface and the end surface. The names you enter here will be the descriptions given to the user of what references to select when adding the UDF to a new part.
Now you are done! To place the UDF in a new part simply have the part open, click the UDF tool and select the new references. I haven’t ever found a time where accepting the defaults is not a good idea.
If you are placing your UDF in a different orientation than in your reference part you may simply click to the next screen and flip references until your UDF is placing properly.
If you are placing your UDF in a part that is not initially compatible you may also redefine the features of UDF in order to place them correctly. Go to the Options tab. Select the features you think you need to redefine (or just click all of them). Then uncheck Auto Regeneration. Click the arrow to go to the first feature. Then click the arrow to go to the last feature and it will jump you into defining the features you want.
Simply adjust the references or dimensions until it is setup properly and click ok until you get back to the placement menu. If everything is good you can accept the UDF.
For any part that is only dimensioned from one orientation this generic box thread UDF will work perfectly when you want to show a tapered premium or API thread. If you need to show the thread from different in section views at a different orientation you will need to copy the cosmetic thread sketch and paste it in that plane as well in order for it to show up on all the right drawing views. There are many steps to creating a UDF but it doesn’t need to take more than a couple minutes once you understand what Creo expects from you. Then you can use those features over and over again easily by just selecting your new references.
Ex. 2 Stub Acme Threads
Previously we saw that creating simple UDFs can be fairly straight forwards if you are familiar with selecting the right references and group your features before making your UDF. UDFs really shine however when they are smart and can adapt to a variety of situations via relations or when you use a family table of features. A family table allows you to create a group of similar UDFs with various feature or dimension combinations that only apply in certain situations. I will show you both relations and family tables in this example. Before we start discuss what we want our feature tree to look like when we are done and why.
Some basic things to note:
• The first feature is a geometry analysis feature. It contains a ref to the ID diameter which we have setup to be the minor minimum of an ID Stub Acme thread. There is also an OD analysis feature.
• There are 3 revolves on the OD and 3 revolves on the ID.
• There are 4 cosmetic thread sketches on the OD and 4 on the ID.
• Each HAS_INT/EXT_THRD_CUT_PARAMETERS feature also has a sub feature that is a note that can be placed on a drawing to callout the Stub Acme size.
In Creo designing a feature that can work both as an ID feature with angles or as an OD feature with angles is impossible as far as I know. Creo doesn’t have any mechanism that knows to flip the direction of an angle if the larger diameter ref gets switched. We could just use ID features and assume that the end user is smart enough and motivated enough to just redefine the angles, but that isn’t very nice of us and is probably a waste of time in the long run.
The diameter analysis features have been created in order to reduce the number of steps required to regenerate all features. Let me explain.
First, I should point out that this UDF is not designed for a specific Stub Acme size. You can place it on any size ID or OD you want and it will generate accurate Stub Acme geometry assuming that you have modeled to maximum material values. This means that the OD you place it on should be the major maximum diameter of the Stub Acme thread and the ID should be the minor minimum diameter of the internal Stub Acme thread. This means also that if the user changes the ref diameter after they have placed the Stub Acme UDF, I want it to again regenerate proper geometry.
Second, the regeneration order of features in Creo goes relations first, then features top down in the feature tree. The only exception to that is if a feature higher up in the tree/creation order references features below it (bad idea). Then it will start trying to make things work as best it can. I ran into problems when I first created this UDF in Wildfire 4 because some of my relations were based on features and also drove other relations that drove other features. Ie. Everything is calculated based on the reference diameter surface. If I chose to make my ID surface entirely larger than my previous revolves, it needed 2 regenerations in order to both update the relations, then the features, then the relations and features again. The problem was that during the first attempt at regeneration there was no longer any material for the revolves and it would fail. The geometry features seemed to update before the relations and this allowed for a smooth one regeneration cycle again. However, I just tested this in Creo 2 and it doesn’t seem like a problem anymore! Nevertheless, I would recommend caution when using multi-step relations-features setups.
Now let’s talk about my design intent a bit. I wanted to give the user the option to choose between having an initial thread relief, an end thread relief or no thread relief at all. And I wanted them to be able to choose to place the Stub Acme thread on the ID or the OD of a part. In the previous example we had no choice but to use a generic thread form to show the tapered thread because when using premium threads the exact thread geometry is proprietary. With API or Stub Acme thread forms we could actually do a helical sweep to show the precise thread geometry. The reason I choose to show the thread form as a hidden line however is for regeneration time. The machine shops already know how to cut a Stub Acme or an API thread and for clarity on the drawing we just call out the thread size, blanking dimensions, thread name and weight if applicable (Oil and Gas threads callout an API casing or tubing weight to fully specify which thread size). You can see a really useful script I made to generate Stub Acme thread callouts here. Since this UDF already knows all the geometry values for the given Stub Acme size it also generates the callout note for the drawing as previously discussed. The only way I could think to give the user all the options I want when placing the UDF is to create a family table of feature groups. This works out well in that it still only creates one UDF. After the user selects our Stub Acme UDF they can then decide which reliefs they want if any.
Now let’s step through each feature for the ID features to show you how this is setup. The ref diameter is the first and is fairly straight forwards.
The first revolve is a little bit tricky to understand. I wanted one feature to contain the relations and parameters that will be referenced by all the other ID features. I also set this up before I had the ref diameter feature. This revolve is actually not required if there is a front relief on the part but it doesn’t hurt anything in Creo having revolves remove material from overlapping spaces.
See below for the relations for the ID features. In order to navigate to feature level relations and parameters you need to open the relations dialog from the Model tab. Then in the drop down for Look In, select Feature and then the feature. This is also how you add feature level relations or parameters.
These are all the relations needed. /* stands for a commented line.
/*sets driving diameter
d = minor_min + (0.6 * p)
/*calculates the values for the note and the cuts
p = 1/TPI
pdt = (0.006 * sqrt(d)) + (0.030 * sqrt(p))
minor_max= minor_min + (0.05 * p)
major_min = d + major_d_offset
major_max = major_min + pdt
pitch_min = d – (0.3 * p)
pitch_max = pitch_min + pdt
relief =ceil(major_max + 0.01,2)
/*sets the dims of cut of the has_int_thrd_cut_parameters feature
/*sets the dims of the int_end_relief_cut feature
/*sets the dims of the int_start_relief_cut feature
There is also a “TPI” feature level parameter needed that the user can set when placing the UDF. I have set the initial value to 8 as that is what we use for just about everything. In this other post you can see how I calculated the Stub Acme dimension values with references to the Machinery’s Handbook 26e.
The next feature is another straight forwards cosmetic sketch 1in long for when the user has selected no reliefs.
We then have an end relief cut and another cosmetic thread for when the user only wants and end relief.
Next you can see the features necessary for only a front relief.
Then the features for both a start and end relief.
You can see with the right features suppressed or active you can achieve each combination independently. This is the requirement for a family table UDF to function properly. This could have been modeled with one revolve for each different scenario as well but I want one feature that can contain the relations and parameters for each scenario. It would just be asking for a mistake to include the relations in 4 different features that all make the same calculations. When you go to update it you would have to remember to update each one.
Now let’s open the UDF Library Menu, click Modify, open our UDF and look at the family table.
You can’t see all the features but there is 16 different features to select for 8 different UDF choices that will be presented to the user. Each choice the user makes simply selects a group of features that will be added to their part. The Instance Name you set here will be the name of each option the user gets to select from. This table is overwhelming to look at in Creo. Luckily there is an option for importing a table from Excel. Excel is 100 times easy to work with for tables than Creo. I have previously added 8 new rows to this table. The Instance Name that is the same as your UDF name is kind of like the master. it needs to have all the features set to yes and is not an option the user gets to pick.
The first thing I did in creating this table was to add columns for every feature that I wanted to include in any UDF option.
This somewhat non-intuitive dialog then pops up where you can choose what type of element the family table column will contain and how many columns there will be. If you wanted to have a dimension vary between UDF feature groups you could select as below.
In this case we are just choosing which features to include and so all of the features above needed to be added.
I also want the user to easily be able to select the TPI of the Stub Acme thread before he places it so I add the TPI parameter as variable like below.
That is basically all to it! You can see that a UDF with several options like this one can take a long time to make. If you know the steps required to make a UDF though this doesn’t take too much longer than it would take to create each different version of a stub acme thread in the future. Since I have created a UDF for each one now though I never have to model a Stub Acme thread again! Also all my notes are associative so when I have to edit my old models for a design change I can just change the one referenced surface diameter and all the Stub Acme geometry, cosmetic thread and the note on the drawing will be updated automatically. Every time I get to do that I thank myself for making this UDF. That really highlights one of the beauties of UDFs. When you are slow at work you can spend time making really awesome things that will save you time for when you are busy! The more areas you can find to make your models smart also saves you from making mistakes from a forgetful memory or from being lazy. If I was just changing a Stub Acme thread by a few thousands of an inch, I probably wouldn’t go back into the model and change everything. I might even just be tempted to only change the note on the drawing. This way it is the same amount of work to do everything as it is to just change the drawing!
One last thing I will caution about is workspaces. It might be wise or company policy to have your UDFs in a different folder than your production work. You might be tempted to try and edit your UDFs in a different folder without changing your workspace. This will most likely cause errors upon trying to redefine features. To edit a UDF you always need to make sure your reference part (_gp.prt) and the UDF (.gph) are in the same workspace and that workspace is active. I found that after editing the features on the reference part, I needed to remove those features from the UDF erase all the current but not displayed objects in Creo’s memory and then re-add each feature that was updated. I am not sure how much this has changed from Wildfire 4 but I leave it here just in case.