How to caculate the distance between a component and other component

Do you know how to implement the function by ruby api as video show?
If you can implement it I can pay some tips.100 dollar,is it ok?I think that can be settled through discussion.But I am from China,we need disscuss how to transfer accounts.



Distance between origins of two component instances:

d = comp1.transformation.origin.distance(comp2.transformation.origin)

Distance between bounds of two instances along X axis.
(We assume comp1 is closer to the model ORIGIN):

x1 = comp1.transformation.origin.x
d = comp2.transformation.origin.x - (x1 + comp1.bounds.width)

REF:

1 Like