There has got to be a better way! 
Author Message
 There has got to be a better way!

Greetings,

Been working with the Visio OM for about 3 weeks now and all I can say
"Wow!"

My problem centers around a current project. It's a throw back to the 80's.
Remember playing those text based games in DOS where you'd have a map and
you had to move around on the little grid map finding things and solving
problems? Remember how "fun" it was to hand draw your map? Well, I've
grabbed Reflection, another awesome VBA supporting proggy by WRQ at
www.wrq.com, and have tied it to Visio. Reflection runs a VBA script that
strips lines of text off the screen, and hands it to Visio for mapping.
There is just one problem... oh, the game? Trade Wars :]

The problem is that the map will contain well over 2000 shapes by the time
it's done, seeing how there are 1000 sectors or squares that need to be
mapped (include 1-D connectors). For each sector about to be mapped, I have
to find which slots around it, in X and Y coordinates are available or not
already occupied by a shape so I don't Drop on top of another shape... So
currently, I have to sort through each shape in the shapes collection using
a crazy For... Next  loop to set each shape as an object, then reference to
the object's PinX and Pin Y cell formulas, and compare that to the PinX and
PinY of the origin shape... sort of looks like a tic-tac-toe grid, with the
center being the current sector, and all the squares around the center being
possible places where the current grid's destination shapes can go.

My question is this, "Can you tell Visio via VBA to search for a shape, much
like you would with an SQL string in a DB, to find a particular shape based
on criteria matching that shape's cell characteristics WITHOUT having to
&#%$# search though every shape in an iterative loop?" I've been looking at
the GetResults method. Is this how I would do it? Could I say, "Search for
any shape with PinX = 1 and PinY = 2, and if one is found, return it's
Name?" Please help, will give credits in shareware program to all those who
help. God help us if there is no other way of searching for shapes. I'd hate
to think what life would be like if you couldn't qualify records in a
database. Thanks!

Casey Lengacher

SMC, Inc.
SMC Applications Programmer

Wh4ss r3wt?



Fri, 08 Nov 2002 03:00:00 GMT  
 There has got to be a better way!
Casey:

Not sure if it would solve your problem, but how about this:

Stick a new shape on the drawing that covers the area that you want to
search. Then use the Shape.SpatialSearch/Relation/Neighbors functions.

Graham

Quote:
> My question is this, "Can you tell Visio via VBA to search for a shape, much
> like you would with an SQL string in a DB, to find a particular shape based
> on criteria matching that shape's cell characteristics WITHOUT having to
> &#%$# search though every shape in an iterative loop?"

-----------------------------------
Graham Wideman
MS MVP for Visio
Resources for programmable diagramming at:
http://www.diagramantics.com
www.wideman-one.com

(Remove the obvious to email me)
-----------------------------------


Fri, 08 Nov 2002 03:00:00 GMT  
 There has got to be a better way!
Thanks mucho!

Your input has enlightened me, and I now better understand both the idealogy
and the role Selections play in the VOM. :)

Casey



Fri, 08 Nov 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Alternative ways of having multiple forms.

2. dropdownlists and grids, which ways is the best?

3. good ways to use recordsets without autocommit?

4. Better ways to schedule?

5. good ways to use recordsets without autocommit?

6. Better ways to put text into textbox??

7. I am using the Compare MS Project COM Program and having issues

8. Questions I am Having Trouble With

9. I am having problems with addnew

10. I am having trouble with bitblt

11. Help!!I am having VB homework problem...

12. Help: I am having trouble with sendkeys

 

 
Powered by phpBB® Forum Software