"IF" fonction in solidedge
"IF" fonction in solidedge
(OP)
Hello
Im having trouble with IF fonctions in solidedge,i can compare 2 variables but its with 3 variables that thing get complicated..
The exercice is a simple cube with three cylinder protruding out the goal is to make the width of the cube equal the biggest of the three cylinders(A,B,C)
Thanks:)
Im having trouble with IF fonctions in solidedge,i can compare 2 variables but its with 3 variables that thing get complicated..
The exercice is a simple cube with three cylinder protruding out the goal is to make the width of the cube equal the biggest of the three cylinders(A,B,C)
Thanks:)





RE: "IF" fonction in solidedge
I am assuming that you are using notepad as a .bas file and then linking this in the variables.
Sub cylinderTest(ByVal InX, ByVal InY, ByVal InZ, ByRef OutX)
If InX > InY And InX > InY then
OutX = InX
ElseIf InY > InZ then
OutX = InY
Else OutX = InZ
End If
End Sub
Where InX = cylinder 1
InY = cylinder 2
InZ = cylinder 3
OutX = the width of the block
Craig Brunton
RE: "IF" fonction in solidedge
I would use the 'Max' function in Excel and link it to SE.
HTH.
Regards
RE: "IF" fonction in solidedge
Just one last question, i know that i can link a formula from excell to SE, but can i do the opposite i.e when i change a value in SE it changes it in Excell?
RE: "IF" fonction in solidedge
Craig
RE: "IF" fonction in solidedge
In the SE Variable Table, select the row you want link.
Click 'Copy Link' in the shortcut menu.
Then in Excel, use 'Paste Link' from 'Paste Special' function to paste the link to a cell.
Now when you change the value in that row in SE, you’ll see the changes in Excel.
I hope this is what you are looking for.
Regards
RE: "IF" fonction in solidedge
That really worked:)
You seem to be an excel expert,if you dont mind i have one more question for you.
I want to use the IF function in excel but with a twist..here an example of what im aiming for
IF A1=(5,10,15,20)
THEN 0 IF FALSE
THEN 1 IF TRUE
My problem is making excel pick between only 5 OR 10 OR 15 or 20,(depending on what value is in cell A1)
In short IF A1 EQUAL 5 OR 10 OR 15 OR 20 THEN THE ANWSER IS 1 anything else is 0
I hope i was clear:)
thanks
RE: "IF" fonction in solidedge
I hope this is what you are looking for;
=IF(A1=5,1,IF(A1=10,1, IF(A1=15,1,IF(A1=20,1,0))))
Regards
RE: "IF" fonction in solidedge
RE: "IF" fonction in solidedge
I managed to link SE variables to Excel but because SE adds the " or Inch after a value therefore when excel tries to read for my "IF" function i think it sees it as a text and not a number, is there a way to tell excel to ignore what comes before and after the value?
i.e this is what appears in excel linked via SE 5.000 in
but
I want excel to just read the "5" and drop the rest!
thanks again:)
RE: "IF" fonction in solidedge
This should work,
=Left(A1)
The above will return as 5
=Left(A1,4)
The above will return as 5.00
Replace 'A1' with the formula.
HTH.
Regards
RE: "IF" fonction in solidedge
The 5 is still a text and not a number.
Try multiplying the formula to 1 as below;
=Left(A1,4)*1
Maybe you can try with the formula below;
=IF(A1="5.000 in",1,IF(A1="10.000 in",1, IF(A1="15.000 in",1,IF(A1="20.000 in",1,0))))
HTH
Regards
RE: "IF" fonction in solidedge
The function wizard in Solid Edge is great but it lacks the IF logical statement. This can be done however as a formula.
Here is an example of the syntax: -7*(A=32)+(-12*(A<>32))
Here is how this works: In this example, you've got two variables, "A" and "B". This formula will exist in the B formula field. In this case, You want the value of B to be 7 if A is equal to 32. If A is not 32 then you want 12 returned to the B value.
You can put any logical statement in parenthesis and it returns -1 if true and 0 if false. Knowing this, the above formula says "If A is equal to 32, then multiply -1 times -7 and 0 times 12, but if A doesn't equal 32 then multiply -7 times 0 and -12 times -1". Try it.
Fred