Jump to content

Compare two elements via Result Element


---
 Share

Recommended Posts

Hello everyone.

I'd like to make a comparsion of two elements using Result element.
Lets say these two elements are two diameters, simply D1 & D2.
For example D1=2mm D2=3.5mm Currently they have a +-0.005mm tolerance but it isnt need to be necessary.
The most important thing is how much their actual size differs from each other. They can deviate from each other by 0.005mm even if they are out of their currently used tolerance.

Example_1: D1 actual=1.998 D2 actual=3.504
D1 deviation is -0.002, D2 deviation is 0.004, its a 0.006 difference, so it isnt passed.

Example_2: D1 actual=2.002 D2 actual=3.504
D1 deviation is 0.002, D2 deviation is 0.004, its a 0.002 difference compared to each other so its passed.

I tried to make it work, but if the signs of the differences are not the same I don't get the correct value.
(abs(getActual("D1").actual-getNominal("D1").nominal)) + (abs(getActual("D2").actual-getNominal("D2").nominal))

Is there a right solution to this problem?

Thanks and BR,
Link to comment
Share on other sites

Wouldn't it be enough to just subtract the (absolute) actuals of both diameters from each other, minus the difference of the nominals (1.5)?

Example 1:
3.504 - 1.998 -1.500 = 0.006

Example 2:
3.504 - 2.002 -1.500 = 0.002

So:
abs(getActual("D1").actual - getActual("D2").actual) - abs(getNominal("D1").nominal - getNominal("D2").nominal)

The second part (blue) is only there to calculate the difference of the nominal diameters. If this value doesn't change in a specific program, you can replace this with the concrete number (1.5) instead.
Link to comment
Share on other sites

if i understand correctky, you want do compare both deviation from nominals

I use this code and it works:

A = (getActual("D1").actual - getNominal("D1").nominal) _will show you deviation from nominal for "D1"_

B = (getActual("D2").actual - getNominal("D2").nominal) _will show you deviation from nominal for "D2"_

C = asb( A - B)

you can combine these calculation in one line or put it in Presetting, and in formula just put "C"

if A = +0.002 B = -0.002 C = 0.004
if A = -0.002 B = -0.002 C = 0.00
if A = -0.002 B = +0.002 C = 0.004
if A = +0.002 B = +0.002 C = 0.000
Link to comment
Share on other sites

Please sign in to view this quote.

this is so much better than my code 😃
didn't know you can use .deviation on features

it shows you how many diffrent way there are, i used "caveman" method 🤣
Link to comment
Share on other sites

 Share

×
×
  • Create New...