What is tolerance in IsAlmostEqualTo Method (XYZ, Double)?

I’m checking if two conduits are parallel (with some tolerance) using the IsAlmostEqualTo method as shown below:

On API remark it reads “tolerance value represents the variation in direction between the vectors”

By trial and error I was able to figure out the tolerance value seems to be pivotal around 0.12325 & 0.12326 for one conduit in XY plane and another one sloped at 10°.

I want the user to enter the tolerance in degrees but can’t seem to figure out how to convert it to a double for the API call?

Tried calculating the dot product & angle between the vectors but that didn’t help!

Does anyone know what’s the calculation behind this tolerance value?

Check If Parallel with Tolerance.dyn (7.8 KB)

cndts = UnwrapElement(IN[0])
tolerance = IN[1]

vecta= cndts[0].Location.Curve.Direction
vectb= cndts[1].Location.Curve.Direction

check = vecta.IsAlmostEqualTo(vectb, tolerance)

OUT = check,vecta,vectb

Hello @AmolShah
IsAlmostEqualTo determines if 2 vectors are the same (not just if they are parallel).

If you want to check parallelism, an alternative is to define your own function with CrossProduct and / or DotProduct (after normalization of vectors)
an example here

3 Likes