Overlaying shapes?

Started by paxmilitia, September 29, 2014, 02:41:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

paxmilitia

I have created some master shapes but as I drag them onto the page, I want to trigger a message box when they are overlapping each other. Is there some VBA code to do this and be able to refer to this in shapesheet cell EventXFMod of each shape? For extra info these shapes belong to the same layer i.e. "Vehicle Database".

The opposite is also true, I want to be able to place these shapes into a "container" and trigger a message box when the shapes are placed outside of this container... This container will belong to a different layer to the shapes.

Any help would be greatly appreciated.

vojo

use the Eventdrop cell to trigger VBA.   VBA would have to do the following
  - "collect" all the shapes on the sheet
  - Retrieve the pinx/piny and width/height and locpinx and locpiny
  - make a "region" data structure for each shape ...something like pinx - 1/2 width to pinx + 1/2 width kind of thing
  - same for dropped shape
  - for each shape on page, calculate whether its region interferes with dropped shape region
  - do something if true

usually when you drop a shape, you drop it where you want it....so could do the reverse and move other shapes
around to make room.   Autoplacement I believe does this.
 

Yacine

Just to add to Vojo's answer. The function you're looking for is spatialneighborhood. There's been a couple of topics on that subject in the forum. Just search for it.
Yacine