How to use maximum or minimum functions like in ms-excel

Creator
Creator

Maximum and minimum functions are present in ms excel. In solid edge I want to use same functions into variables. Actually I have an assembly where one of the dimension should be minimum of other two dimensions.

 

Say  V101=minimum (V102 , V103)

 

how to do this in solid edge. What is the syntax to write this type of equations. Do solid edge supports logical operators in variable tables?

 

6 REPLIES

Variable table in the current version does not support th...

Phenom
Phenom

Variable table in the current version does not support the minimum function.

But there are several possibilites assuming you want to compare just two values:

 

1. From the variable table right-click the row for V102 and select Copy Link from the context menu. Go to Excel and Paste Special, select the Paste Link radio button in the dialog that appears.

Ditto for V103. This will setup a SE-Excel link for the variables to compare. Use the cells in Excel in the =MIN() function there.

Next Copy the result of the MIN() function from Excel and back in the variable table, Paste Link (not Paste) the result into V101. This wil setup a Excel-SE link and everytime the values of V101 or V102 chage in Solid Edge they will be updated in Excel and the result of MIN() from Excel will be updated in Solid Edge.

 

2. Another method would be to write a little logic for calculating the minimum (actually smaller) of the two values. Use notepad and paste the following code:

 

Function minimum(ByVal V102 As Double, ByVal V103 As Double) As Double
    If V102 < V103 Then
        minimum = V102
    ElseIf V103 < V102 Then
        minimum = V103
    End If
End Function

Save the file as minimum.bas (avoid saving as minimum.txt).

In the variable table click in the cell for V101 and click the Function (fx) button.

Select Visual Basic from the list and pick the minimum.bas file.

Select the function that reads minimum.minimum and click Next.

Specify V102 and V103 and click Finish

 

 Untitled.png

 

Note however that both methods are an overkill to just find the smaller of two given numbers.

Hope this helps.

Re: Variable table in the current version does not support th...

Creator
Creator
thankx friend

I ALREADY TRIED DOING UR 1ST METHOD. LINKS PASTED FROM SOLID EDGE, SHOW VALUES IN EXCEL SHEET AS (XXX mm) AND THUS THE FUNCTIONAL CALCULATION IN EXCEL SHEET IS NOT POSSIBLE.

AND FRIEND I AM TRYING MORE COMPEX EQUATION, I WROTE MAX OR MIN FOR ASKING IT TO U IN SIMPLER WAY

ANY WAY THANKX A LOT

Re: Variable table in the current version does not support th...

Phenom
Phenom
Try creating a scalar variable for each dimension parameter in the variable table. You can then use the scalar to link with Excel since it does not have the mm.
I misplaced my earplugs though Smiley Happy

V101 = -1*( V102 < V103 )* V102 +-1*( V103 <= V102 )* V103

Genius
Genius

V101 = -1*( V102 < V103 )* V102 +-1*( V103 <= V102 )* V103

Re: V101 = -1*( V102 < V103 )* V102 +-1*( V103 <= V102 )* V103

Phenom
Phenom

Tried it out, works like a charm.
Scanned the SE ST 6 online help on variable table thoroughly but could not locate where it says logical operators could be used.

 

Further I tried this out in Excel but it always gives me a negative value:

 

Untitled.png

 

Re: V101 = -1*( V102 < V103 )* V102 +-1*( V103 <= V102 )* V103

Phenom
Phenom
After some recent learning found an answer to the question about Excel in the last comment.
The logical operator in Solid Edge returns a -1 or 0 based on whether the condition evaluates to true or false whereas Excel returns 1 and 0, hence the answer is negative. Best way is to always use the ABS function ahead of any logical operators whose output is multiplied by a scalar.