Author Topic: Shape text based on existing shapes on page  (Read 2116 times)

0 Members and 1 Guest are viewing this topic.

Miki

  • Jr. Member
  • **
  • Posts: 61
Shape text based on existing shapes on page
« on: April 30, 2015, 10:38:08 AM »
Hello,
I have an "Area" shape which I created to assign different area types. Basically what this shape does is when you drop it on the page, it asks you to select whether it is Area C, Area D or Area E. Once you select, lets say you selected "Area C", the the text in the shape will say its name and area (For e.g.: "Area C: 2 acres").
What I need to do is, if I drop the shape and select "Area C", then it should scan the page to see if there is any "Area C" already on the page or not. If there are no "Area C" on the page then the text should say "Area C1: 2 acres". If there is one "Area C" on the page, then the text should say "Area C2: 2 acres".
I want to know if this is possible by doing something in Shapesheet or do I have to write a code for that.

Any help is appreciated.

Thanks,

- Miki

PS: Don't know if I have posted in the correct location. Thought this is a shapesheet question.

Yacine

  • Hero Member
  • *****
  • Posts: 2714
Re: Shape text based on existing shapes on page
« Reply #1 on: April 30, 2015, 11:41:02 AM »
Hi Miki,
Your problem can be solved - but not without code.
The trick is to call a macro whenever a new shape is dropped or the area type changes.
This is done by the shapesheet function CALLTHIS.
In the macro, you would then iterate through all the shapes of the active page, check if the found shape has the right cells and the right values in the cells, then increment a counter.
At the end the counter will be assigned to the "number" field of the shape.
This is of course a very primitive method as it does not consider shapes that could have been deleted meanwhile. There's been a long discussion about this issue in the forum a while ago, but I could not find it. You may try finding it by yourself.

I attach a drawing in which I demonstrate the idea.
« Last Edit: May 01, 2015, 02:51:13 AM by Yacine »
Yacine

Miki

  • Jr. Member
  • **
  • Posts: 61
Re: Shape text based on existing shapes on page
« Reply #2 on: April 30, 2015, 12:23:37 PM »
Thanks Yacine!
I had this thing in mind but wanted to know if I could do it without the code.
Thanks for the  prompt response.
I'll try the to find if I can tackle the issue of deleted shape. Will post it here if I am successful.

- Miki

Yacine

  • Hero Member
  • *****
  • Posts: 2714
Re: Shape text based on existing shapes on page
« Reply #3 on: May 01, 2015, 02:54:59 AM »
Most important is to decide whether you want to fill in gaps or just take the highest available number.
(Versioning issue)
Yacine