Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling Decimal Places Of A Parameter Value Through A Formula

Status
Not open for further replies.

TorsionalStress

Mechanical
May 23, 2005
234
CA
Using Catia V5R19, Service Pack 8, Build Number 19;

Is it possible to control the decimal places of a value parameter by means of a formula?

Any response will be greatly appreciated!
 
Replies continue below

Recommended for you

Perhaps.

Tools - Options - General - Parameters and Measures - Units
this will show on a global scale for all parameters.

You can also use the round math function. see attached.
I made 4 parameters
length.1 - input
length.2 - result
round_num (integer)for the number of decimal places to round to
Unit (string) multi pull down for in or mm (inch or milli)

Regards,
Derek
 
 http://files.engineering.com/getfile.aspx?folder=7e7d004b-25ce-44d9-ac5b-159354c62897&file=round.jpg
Derek, I’m getting an error when placing the units. Can you cut & paste a picture of the Formula Editor popup menu to illustrate how to actually piece together the formula?
 
in the formula editor it would look like

if you want to forget Unit as a variable string and round_num as a variable integer

below is units inch and 2 decimal places
round(Length.1,"in",2)


round(Length.1,Unit,round_num)

what is important is the variable types.

Length.1 is a length
Length.2 is a Length
Unit is a type string
round_num is type integer

what error are you receiving?

 
 http://files.engineering.com/getfile.aspx?folder=b58fabfb-5c7d-42ec-80f6-407763a3ca9f&file=fx_editor.JPG
The error that I’m getting is,

Syntax Error line 1 :
Parameter Radius.1 cannot be used in this context.
Do you want to go back to the editor (otherwise the relation will be broken and deactivated)

I want to associate a driving dimension in the sketch environment with a formula by;
• right-clicking the dimension
• Scrolling down to xxx.x object
• Clicking on “Edit formula”
 
Radius.1 in the Constraint definition box can not be set to Dimension -- Diameter and have a formula attached to it. Set it to Radius and you can simply apply a /2 at the end of your formula.


Retarded I know, but older versions of Catia this was a Radius only and would cause severe problems with peoples scripts and code if they toggled it in a major revision change.


Regards,
Derek
 
What I am trying to achieve is the following;
•Control the decimal precision of a driving dimension in the part environment
•Dimension that driving dimension in a drawing maintaining the decimal precision from the part environment, over writing the global decimal precision.

I have been able to achieve this by locking the parameters, but the drawback is that you have to unlock the parameters if you want to edit the sketch and/or feature dimension.
 
Derek don’t be scared, it’s actually a good question.

Answer:
When I detail features (i.e. Detailing a counterbore from its top view) using the “Attribute Link” inside a Text editor box, the decimal precision is displayed with respect to what the global settings are at that moment. At first it’s OK, but if you change the global decimal precision setting and update the drawing, those linked values get updated to the new decimal precision setting. I want to eliminate this from happening. So I figured if I can force the sketched/part feature dimension in the desired decimal precision it will never change regardless of what the global setting precision is.
 
The reason being is if I have several different sizes of counterbores, I don’t want to create a section view for everyone because the drawing can become very messy. Might you have a different approach?
 


A couple of things to think about.

1)
Tools - Options - Mechanical Design - Draft - Administration

Prevent update of standard
Prevent switch of standard

2)
Select the dimension in drafting - edit properties
Graphics tab - Turn off pickable.
This will make it impossible to select the dimension on the screen
To set it back you will have to search and select - all dimensions and set them all back to pickable.

3)
Just a time saver but do you use Generate Dimensions? Works great if your models are have constraints and history.


Regards,
Derek

 
1. What I’m trying to accomplish isn’t a standard because it’s not always the case. In the future I might need feature dimensions with higher or lower precision.
2. I have turned off “pickable” and it does not prevent the values from changing because they are dependent on the global settings in “Parameters and Measure”/ “Units”.
3. No, I’ve never used “Generate Dimensions” always the standard dimensions toolbar.
 
I’ve tried both options, “Round (Real): Real ” & “Round (Real, String, Integer): Real” and I can’t make the “inch” units work. Can anyone type out exactly how the formula should be in either case to make the units convert? Thanks!
 
Derek thanks a lot, it works now. Unfortunately, it doesn’t give me what I was hoping for. The “round” function actually rounds the value of the sketch to the desired decimal place of the actual part and not the dimension value in the drawing. The dimension is still controlled by the global setting.
 
Yes but you can select the dimension value and set the decimal place. This should not be adjusted unless the operator specifically changes it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top