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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Initial Summary - Controlling Parameter Decimal Places In Sketch

21-Topaz II

Initial Summary - Controlling Parameter Decimal Places In Sketch

Two suggestions:

1 - Set param_dec_places in your to 3. This works, but if I
send this file back to the client and they haven't set this option, once
the file is regenerated the model will change. Not good. This seems to
fly in the face of so many things in Pro|E where care is taken that the
software settings cannot change model geometry once it is created.

2 - Use &area:FID_2950[3], where the integer inside the brackets
controls the decimal places. However, as you can see, the text field is
grayed out, you cannot change the text when using a parameter. Checking
'Enter Text Manually' and entering that string simple places that string
in the part, it does not link to the parameter.

So - the config option works, but I'd really like a solution that will
produce consistent model geometry regardless of the config settings of
the user.

Any other ideas?

Doug Schaefer

This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
Doug Schaefer | Experienced Mechanical Design Engineer

Try the following:

Define the Analysis feature.
Create a partlevel parameter AREA_3PLC of data type STRING.
Create afeature level relation in the analysis feature.
The relation has an internal parameter AREA which holds the REAL value of the measure.
The variable D below controls the number of decimals the new STRING parameter will contain.
Set your text to the parameter AREA_3PLC in your feature (assuming 3 places is desired).
The code below sets the number up as a string which is independent of the rounding settings in Pro/E.

Good Luck

Jason Richards
Engineering Manager
Teleflex Marine

props to Tips from Joe:

Add the code belowto the relations windowof the Area Measure analysis feature:

/*Code Starts Here*/

D = 3

/* First accurately round theAREAmeasureto 3 Decimals */

X= AREA * 10^D/*shift the decimal place D positions left*/
AFLOOR = FLOOR(AREA,D) *10^D/*round up the shifted value*/
IF X - AFLOOR < 0.5/*subtractfrom the shifted value and test if round up or down*/
X = FLOOR(AREA,D) /*if down*/
X = CEIL(AREA,D) /*if up*/

/* Now convert to a string.Pull out the value before the decimal place and generate the value in back */


/* Use ITOS to convert the integer value to a string value */

AREA_3PLC= "0." + ITOS(BACK*10^D) /* To preserve possible leading zero */

NEW Creo+ Topics: PTC Control Center and Creo+ Portal