Can you use the excel IF function in a text box in Inventor

Can you use the excel IF function in a text box in Inventor

Anonymous
Not applicable
2,875 Views
12 Replies
Message 1 of 13

Can you use the excel IF function in a text box in Inventor

Anonymous
Not applicable

i have a model using an excel spreadsheet for parameters in it. it appears some of the excel formulas are not compatible with inventor. i used ceiling.math() in excel and had to rewrite the formula directly in the edit box in inventor as ceil() i currently have a if formula in excel (=IF(B37=0.375,0.407,0.28125) but it does not transfer over into inventor. an thoughts

0 Likes
Accepted solutions (1)
2,876 Views
12 Replies
Replies (12)
Message 2 of 13

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 

 

Welcome to the forum. There might be a way to do what you're attempting to do, but you can't use the excel formula. 

 

If you give a better idea of your broader goal, someone can likely offer suggestions on how to achieve it.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 3 of 13

Anonymous
Not applicable

I am making a door and i need to have four hinges over a certain height and three under a certain height so the excel formula i used is (=if(DOW>84,4,3). is there a inventor equivalent i can use since the excel one is not acceptable. the same model uses ceiling.math() in excel file but i had to rewrite the formula as ceil() in inventor and it worked

0 Likes
Message 4 of 13

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @Anonymous ,

 

Okay, there is no ability to use if/then statements in an Inventor parameter equation, so I think an ilogic rule would be your best bet. 

 

This image shows how to create a rule to set a parameter called HingeCount (adjust that to your parameter name )

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum :
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

aaa.png

EESignature

Message 5 of 13

SBix26
Consultant
Consultant

I can't seem to find it by a forum search, but I know this has been done in the past with a combination of abs, sign, max and/or min functions.  In your example, the following will do the job:

 

HingeQty = sign(DOW - 84 in) + 3 ul

 

It takes a bit of fooling around and some imagination, but the parameter functions can be used to emulate quite a few more sophisticated functions from Excel.  I know there's a reference somewhere with a pretty good selection, I just couldn't figure out the right search terms.


Sam B
Inventor Pro 2020.1.1 | Windows 7 SP1
LinkedIn

0 Likes
Message 6 of 13

Curtis_Waguespack
Consultant
Consultant

@SBix26 

 

This might be the thread you were remembering:

https://forums.autodesk.com/t5/inventor-forum/if-then-operations-for-parameters/m-p/5304363#M523084

 

I found that yesterday when searching for a Sean Dotson PDF on the subject from way back in the day, I found it here:

https://ww3.cad.de/foren/ubb/uploads/lbcad/vbafunctionsinpartspartone.pdf

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 7 of 13

SBix26
Consultant
Consultant

That would be the one.  Thanks, @Curtis_Waguespack 


Sam B
Inventor Pro 2020.1.1 | Windows 7 SP1
LinkedIn

Message 8 of 13

Anonymous
Not applicable

i cannot get this to work with a rule. when i try to enter as a value into my array i get it was expecting (ul) but is (in)

 
 
0 Likes
Message 9 of 13

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 

 

Using iLogic you can just push the value to the parameter and not worry about the units, So something like this will work .

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

If DOW > 84 Then	
	HINGE_COUNT = 3
Else	
	HINGE_COUNT = 4
End if

EESignature

0 Likes
Message 10 of 13

Anonymous
Not applicable

Creating the rule is not the problem i cannot enter the parameter in the window. i am using a rectangular pattern and the first box does not except the parameter name or any formula i can think to try not sure the requirement difference between the two boxes but it accepts it in the lower one but not the top where i need it

0 Likes
Message 11 of 13

SBix26
Consultant
Consultant

@Anonymous wrote:

... the first box does not exceptaccept the parameter name or any formula i can think to try not sure the requirement difference between the two boxes but it accepts it in the lower one but not the top where i need it


Do you mean the two boxes in the Rectangular Pattern dialog?  The first is the number of instances and therefore must be unitless (ul); the second is the spacing, and therefore needs a distance measurement.  Therefore, since Inventor will accept HINGE_COUNT in the second but not the first, I conclude that HINGE_COUNT is specified as a distance, probably inches (in).  Can you embed a screenshot of your Parameters dialog box?  Seems that the parameter got created with the wrong units.  Was it created by the iLogic rule, or manually?


Sam B
Inventor Pro 2020.1.1 | Windows 7 SP1
LinkedIn

Message 12 of 13

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 


As SBix26 mentioned your HINGE_COUNT parameter probably just needs to be set to be unitless (ul) , which you can be done in the parameters editor dialog box.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 13 of 13

Anonymous
Not applicable

Yes.

If there's excel and textboxes in Inventor then yes, you can use the IF function.
The IF function allows you to test a condition and return one of two different results if it is met (see below image). So if you had two text boxes with numbers inside, for example, the first would equal 10 if x = 10 else 20 would equal 20 etc. else would be whatever follows else; in this case it could be nothing at all or anything that follows that comma. As long as more than one result can be returned from the IF statement, then its good to go! You can also include decimal points into your calculation using "."s between whole numbers but before decimals. Reference

https://www.exceltrick.com/formulas_macros/excel-if-statement/