I'm looking for a macro that can detect distance between objects. Is there one that can do that? I want to be able to give a value and then have the script search and find any objects that are closer to each other than the value specified. Thanks
Joseph
Actually I may have needlessly complicated things by suggesting IsOnShape as there's the wonderful SelectShapesAtPoint function. I'm including an example in the name of showing different approaches:
Sub AreShapesClose() Dim S As Shape Dim Gap As Double Gap = ActiveDocument.ToUnits(20, cdrMillimeter) 'Set the gap around around our circular shape - in mm in this case For Each S In ActiveLayer.Shapes 'Iterate through all the shapes in our active layer If ActivePage.SelectShapesAtPoint(S.CenterX, S.CenterY, True, S.SizeWidth / 2 + Gap).Shapes.Count > 1 Then 'If it has selected more shapes than the current shape in a circle around it then those other shapes are within 'our radius - let's mark them ActiveSelection.Shapes.All.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0) End If Next S End Sub
Using this will mark all the shapes that are within the given distance (Gap) of another shape