Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Trouble with long equation using IF parameter

01165479
Explorer

Trouble with long equation using IF parameter

01165479
Explorer
Explorer

Hello, what I want to achieve, is simple "if there are x number of holes, perform this equation" via parameter.
I got "a" defined in mm and "hole" defined without unit.

I run into trouble when creating the unit less parameter for the required equation
"invalid string ";" in expression"
Here is my code

if((hole==2; (a / 2)); (hole==3; ((a * sqrt(3)) / 2)); ((hole==4; (a * sqrt(2)) / 2)); (hole==5; ((a * sqrt(50 + 10 * sqrt(5))) / 10)); (hole==6; a); (hole==7; (a / (2 * sin(PI / 7)))); (hole==8; (a * sqrt((2 + sqrt(2)) / 2))); 0)

Could anyone help me review this? 

0 Likes
Reply
Accepted solutions (1)
541 Views
11 Replies
Replies (11)

CGBenner
Community Manager
Community Manager

@01165479 

Welcome to the forum.  I've moved your post here for better visibility.  Good luck!


Chris Benner
Industry Community Manager – Design & Manufacturing


If a response answers your question, please use  ACCEPT SOLUTION  to assist other users later.


Also be generous with Likes!  Thank you and enjoy!


Become an Autodesk Fusion Insider
Inventor/Beta Feedback Project
0 Likes

g-andresen
Consultant
Consultant

Hi,

Please share the file with the equation

 

File > export > save as f3d on local drive  > attach to post

 

günther

0 Likes

g-andresen
Consultant
Consultant

Hi,

gandresen_1-1727287099280.png

 

 

have a look at Product Documentation 

 

günther

 

1 Like

johnsonshiue
Community Manager
Community Manager

Hi! Either there is a bug in the Fusion equation parser or there is an inconsistent unit issue (not all terms have the same type of unit). Please share the f3d file here. The forum experts can help take a further look.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes

etfrench
Mentor
Mentor

Impossible to tell without knowing how each parameter has been defined.

ETFrench

EESignature

0 Likes

g-andresen
Consultant
Consultant
Accepted solution

Hi,

1. each condition is introduced with an IF.
2. if you want a value without units, you must divide by mm at the end. (Reason: a has units)
3. the unit rad must be added for the sine, because otherwise Fusion assumes that PI is the number 3.14 and adds the unit deg.
@johnsonshiue  Is this intentional?


4. @johnsonshiue 

the values PI ~ 180° and 2*PI ~ 360° are wrong for the sine.

 

 

günther

 

0 Likes

johnsonshiue
Community Manager
Community Manager

Hi Günther,

 

Many thanks for sharing the file and the comments! I do believe this is the intended behavior. Fusion equation is indeed unit sensitive. If you enter a value without a unit attached, the default unit for the particular function will be added. The default angular unit is degree, not rad. You may change it in the Preferences -> Default Units.

Thanks again!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
2 Likes

CGBenner
Community Manager
Community Manager

@01165479 Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!


Chris Benner
Industry Community Manager – Design & Manufacturing


If a response answers your question, please use  ACCEPT SOLUTION  to assist other users later.


Also be generous with Likes!  Thank you and enjoy!


Become an Autodesk Fusion Insider
Inventor/Beta Feedback Project
0 Likes

g-andresen
Consultant
Consultant

Hi,

Many thanks for the feedback.


Is there an explanation for the sine 180deg & 360deg ?

 

günther

 

0 Likes

johnsonshiue
Community Manager
Community Manager

Hi Günther,

 

Regarding the values returned from trigonometric functions, the minute numerical deviation is due to how these functions are being approximated numerically. Some programs limit the number of decimal places so that the noise is not shown. In Fusion, you may add a wrap around the functions by using "round()." With or without the wrap, the result should be the same.

Here is an explanation of why such deviation exists. 

https://stackoverflow.com/questions/51820357/c-trigonometric-function-returns-unexpected-value

 

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes

g-andresen
Consultant
Consultant

Hi,

Many thanks for the info.
I came across this behavior by chance and don't currently have a design example where this could play a role.

 

günther

1 Like