Linking parameters to text tool
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Linking parameters to text tool
Hi folks,
Working on a piece of coursework at the moment related to parametric relations and use of the family tree tool. The coursework involves creating families of drill bits with certain dimensions specified by the lecturer. I have written relations to create the drill bits (there are approximately 60-70 split between 3 family trees).
The coursework specifies that the drill bits should have text punched into the shanks like so: "Series, Diameter, Flute length". When I realized that the text tool would only accept one parameter at a time I decided just to use it multiple times and create a relation for the spacing between each (as this is driven by text size which in turn is driven by shank diameter). In an ideal world I would have one parameter for the text that combined my existing 3 parameters (SERIES, TDIA, TFLU) so that they read "MD, Ø0.1, 1.2" for example.
A second problem arises when I link the parameters since CREO displays them to 6 decimal places - I only need 1 decimal place for the text. I've already made independent parameters for the text so anything that edits them won't affect the rest of the geometry.
How can I amalgamate 3 separate parameters into a single parameter to make using the text tool more efficient?
How can I reduce the number of decimal places that are displayed by a parameter in the text tool?
Hope someone has an answer as it would take hours to do them manually!
Cameron
Solved! Go to Solution.
- Labels:
-
General
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
There are multiple topics about converting a NUMBER to a TEXT and manipulating the DECIMALS.
I will try to find them and post them here:
As for combining three parameters into one, that's easy once you have converted your NUMBERS to TEXT.
Complete code (paste in the RELATIONS of a part)
SERIES = "MD"
TDIA = 0.12345678
TFLU = 1.23456789
DEC_PLACES = 2
TDIA_RN = FLOOR((TDIA+(5/10^(DEC_PLACES+1))),DEC_PLACES)
IF FLOOR(TDIA_RN) == 0
TDIA_STRING = "0."+EXTRACT(ITOS((TDIA_RN-FLOOR(TDIA_RN)+1)*10^(DEC_PLACES)),2,DEC_PLACES)
ELSE
TDIA_STRING = ITOS(FLOOR(TDIA_RN))+"."+EXTRACT(ITOS((TDIA_RN-FLOOR(TDIA_RN)+1)*10^(DEC_PLACES)),2,DEC_PLACES)
ENDIF
TFLU_RN = FLOOR((TFLU+(5/10^(DEC_PLACES+1))),DEC_PLACES)
IF FLOOR(TFLU_RN) == 0
TFLU_STRING = "0."+EXTRACT(ITOS((TFLU_RN-FLOOR(TFLU_RN)+1)*10^(DEC_PLACES)),2,DEC_PLACES)
ELSE
TFLU_STRING = ITOS(FLOOR(TFLU_RN))+"."+EXTRACT(ITOS((TFLU_RN-FLOOR(TFLU_RN)+1)*10^(DEC_PLACES)),2,DEC_PLACES)
ENDIF
TEXT = SERIES+", Ø"+TDIA_STRING+", "+TFLU_STRING
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
There are multiple topics about converting a NUMBER to a TEXT and manipulating the DECIMALS.
I will try to find them and post them here:
As for combining three parameters into one, that's easy once you have converted your NUMBERS to TEXT.
Complete code (paste in the RELATIONS of a part)
SERIES = "MD"
TDIA = 0.12345678
TFLU = 1.23456789
DEC_PLACES = 2
TDIA_RN = FLOOR((TDIA+(5/10^(DEC_PLACES+1))),DEC_PLACES)
IF FLOOR(TDIA_RN) == 0
TDIA_STRING = "0."+EXTRACT(ITOS((TDIA_RN-FLOOR(TDIA_RN)+1)*10^(DEC_PLACES)),2,DEC_PLACES)
ELSE
TDIA_STRING = ITOS(FLOOR(TDIA_RN))+"."+EXTRACT(ITOS((TDIA_RN-FLOOR(TDIA_RN)+1)*10^(DEC_PLACES)),2,DEC_PLACES)
ENDIF
TFLU_RN = FLOOR((TFLU+(5/10^(DEC_PLACES+1))),DEC_PLACES)
IF FLOOR(TFLU_RN) == 0
TFLU_STRING = "0."+EXTRACT(ITOS((TFLU_RN-FLOOR(TFLU_RN)+1)*10^(DEC_PLACES)),2,DEC_PLACES)
ELSE
TFLU_STRING = ITOS(FLOOR(TFLU_RN))+"."+EXTRACT(ITOS((TFLU_RN-FLOOR(TFLU_RN)+1)*10^(DEC_PLACES)),2,DEC_PLACES)
ENDIF
TEXT = SERIES+", Ø"+TDIA_STRING+", "+TFLU_STRING
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Take a look at this post: https://community.ptc.com/t5/Creo-Modeling-Questions/Converting-Real-Numbers-to-Strings/m-p/189624
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
That's one of the posts I was searching for! :lol:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks both, that's solved the problem perfectly!