Reading in shapes on a page from an add-in, I need to separate the connectors from the 2D shapes.
Of course I can use a Shape.OneD = True/False check.
On this diagram (about 8000 shapes total) it is faster to use Page.GetResults to bulk-read a specific cell on all shapes that I can use to do a 1D/2D shape check.
Is there a cell on all shapes that I can check the value of to distinguish 1D/2D shapes?
If this is a cell that is not on all shapes, then I have to use CellsSRCExists which is slow as well.
A bulk check with GetResults/GetFormulas really speeds things up.
Thank you for your advice and insight!
What I can find is this cell that seems to be on all shapes I've seen so far:
https://docs.microsoft.com/en-us/office/client-developer/visio/objtype-cell-miscellaneous-section
Do 1D connectors always have this value:
&H2
Shape is routable. Must be a one-dimensional (1-D) shape.
visLOFlagsRoutable
In that case I just check for the value 2 and separate the shapes this way! Just need to be sure this is always true (I only use dynamic connectors that move as the 2D shape's they're connected to move).
Not at my computer, but in the Misc section, I think, there's a cell relating to shape type, upper right corner of that section???. It signals shape behavior. If you select a shape, and open shapesheet in another window, then watch value as you toggle behavior between 1-D and 2-D. Or just check different shapes.
But, this is assignable, so a 2-D shape could have 1-D behavior and visa versa. Plus, there's a difference between a line and a connector. Other than that, this is the only cell I'm aware of. Unless you create your own.
I'm not sure how the shape.oneD works in the object model. That is, if a 2-D shape is assigned to have 1-D behavior, will it be considered as a shape.oneD???
Thank you wapperdude good to know there may be some in-between cases where checking Shape.OneD or the ObjType cell may not mean this is either a 'real' 1D or 2D shape in some cases.
Quick test shows that shape.OneD finds: lines, connectors, and 2-D shapes that have 1-D behavior and ignores 2-D shapes plus 1-D shapes with 2-D behavior assigned.
Thank you good to know, what are considered 2D shapes with 1D behavior as far as I know I don't use such shapes (yet)?
If you're still curious about this, use the Rack Diagram template and drop a Rack or Cabinet onto the page. Most of the other shapes in the Rack-mounted Equipment stencil (Server, Switch, Router) are 2-D shape set to have 1-D behavior so they can be glued to the side rails of the rack.