I want to put an expression in dimension text,
for example, most of the time I have threaded holes with depth being twice the nominal thread. (M3 => depth 6, M4 => depth 8). I want to make something like
M<X> depth 2*<X> (where X is the nominal thread, and the expression 2*<X> is automatically evaluated and then appears in the dimension text).
if we only need a dimension value, we can simply use &d#, but here I need a result from an expression with that dimension value. Is there any method to do that?
Thank you in advance!
There is no way to automatically add text into a particular hole dimension. That being said it sounds like what you need is a custom hole note. Some threads on hole notes:
CALLOUT_FORMAT in *.hol files
modifing UNF.hol file - help!!
In particular you might want to change the DEPTH_RATIO to 2 (see below as an example)
CALLOUT_FORMAT &METRIC_SIZE x &THREAD_DEPTH[.0] DP /(&PATTERN_NO x)
Thank you for your reply! It is very kind of you to also introduce discussions on hole note.
However, my example is just an example, I have already used custom hole charts, but there is something I still couldn't do.
What I want to know is whether there is a way to evaluate an expression in dimension text (hole note) is ok. I will elaborate on my question in a reply in this thread.
My preferred method of doing this is to use a reference to the depth dimension. If there is an actual feature in the model for the tapped hole, it must have an accompanying depth dimension, so you can just reference that. Something like:
M&diameter, &depth DEEP
Or whatever your preferred nomenclature is for tapped holes. The &size is the dimension for the hole diameter or thread or whatever, the &depth is the dimension ID for the depth of the hole.
I really don't like putting plain text into dimensions specifying things like depths and the like because they do not reflect the actual model, so if someone in the future realizes that you actually need 3 diameters of depth because the hole is in something weak, like acrylic, they might change the model but unless they manually change the dimension text the change won't show up on the drawing.
Thank you for your reply,
I also don't want to use plain text, that is why I wonder whether there is a way to use an expression in the dimension text (hole note is also ok).
As I said in the original question, if we need to refer to a dimension, it is simple (using &d#, &p#, &r# or something like that, as you explained in your answer).
However, I want to use a value derived from a dimension. Eg, I want to include <2*depth>, not <depth>
I am sorry for not making my question clear enough. Now I will talk about it in details in a comment/reply.
Fundamentally you can't do "math" in a note. You need to find some way to calculate the value somewhere else and then just refer to the result in the note. As @Chris3 stated, it's probably easiest/best to just adjust the .hol file so it actually generates the hole geometry AND the hole note with the value you want, but if that's not an option then you will probably need to use feature relations inside each hole feature to drive a feature specific parameter that you can reference in your note. Of course the challenge with this approach is that you will need to modify each and every hole feature you create. Mapkeys can help with this, but it's still a departure from the 'out of the box' approach provided by the hole feature.
Sorry for not making my question clear.
I want to know whether we can evaluate an expression in dimension text (hole note is also ok).
I can achieve what I described in my example by editing a custom hole chart, but that is not what I want to do. It is just an example of a case where being able to use expressions in notes or dimension texts is helpful.
Here is what I am working on.
I want to create reaming holes with notes or dimension text.
For example, to make a Φ3.1 reaming hole in the model, and have the text "Φ3.1 reaming hole depth 5, thru" (Just an example, thru means the original hole is a through hole) ready when click "show model annotation" in drawing.
The reaming depth (5) should not be plain text, it must be a value retrieved from the model.
I was thinking of several methods to achieve this.
1. Drill two holes at the same location, one is Φ3 through and the second is Φ3.1 with the depth equal to the depth of our reaming hole. I can format the note for this Φ3.1 hole and only show it when click "show model annotation"
The problem with this approach is, when we make hole tables, both holes will appear. We only need the Φ3.1 one. It is possible to delete the Φ3 hole from hole table, but with hundred of reaming holes, it will be impractical (by the way, if there is a way to do that, please tell me.)
We can not make only one hole for the Φ3.1, because we want a small through hole. If we don't make that through hole in the model, the model will be different from what we actually want and problems may arise later.
The problem will be solved if we can use an expression to get the depth (5) from the reaming diameter (3.1) (eg. floor(2*Φ)). Then we can drill only one Φ3.1 through hole and use the note with the calculated depth.
2. Use user defined function.
When we drill a hole (without note), edit dimension text, and create an UDF with that hole, any future holes created with that UDF will have the same dimension text. So if we format the dimension text as, for example @D depth &d8 (d8 is the depth of the hole), any holes created with that UDF will readily have a dimension text with its diameter and depth.
The problem her is that in our case, the hole is through, we don't need d8, we need something like @D depth floor(2*@D)
Unfortunately, 2*@D is not something recognized by Creo, and I could not find any syntax for an expression in dimension text (maybe it doesn't exist).
So, in short, i) I want to make a hole feature, whose note (or dimension text) readily includes its diameter and reaming depth (so that I can just show model annotation and don't need to make any new dimension text or note for the feature.) ii) That reaming depth should depend on the feature (not plain text). and iii) The feature should appear as one hole in a hole table.
If somehow I can write an expression that can be evaluated in dimension texts or notes (eg. if Φ = 2 and the expression means 2Φ, the evaluated value of 4 should appear in the dimension text or hole note).
I greatly appreciate all your help. Thank you for reading this long question.
Your example sounds like a standard hole with a counterbore standard profile. You can also sketch the hole profile for more complex profiles or to provide relations in the profile. Saved profiles can also be saved and retrieved.
Take a look at the attached model and corresponding UDFs. There are two different methods shown - one using a single hole feature and one using two hole features in a group. These will automatically update the notes and clearance holes as the ream hole changes size.
Pay attention to the feature relations present in the different hole features.
Keep in mind that these were just thrown together for demonstration purposes. There are further refinements that should be done before putting into production.
Thank you so much for spending time for this question!
So it seems you were hoping there was some sort of "inline macro" used by text to evaluate expressions and put the results into the string. There is no such thing. You can put in dimension/parameter values, but nothing involving mathematical calculations, etc. Stuff like this can be done with relations, but that doesn't seem to be what you need. I wonder if using a hole feature for the reamed depth and then a protrusion for the thru hole would let you avoid double hole table entries?