I have made an add-in for Visio that extracts information from Visio shapes to a json file, so that I can recreate Visio drawings in other applications. Now I am working on expanding to getting more than straight lines so I am trying to access the Name property of a shape's Geometry.
I can access the X and Y columns with the following code:
var offsetX = shape.CellsSRC[s, r, (short)Visio.VisCellIndices.visX].ResultIU;
var offsetY = shape.CellsSRC[s, r, (short)Visio.VisCellIndices.visY].ResultIU;
I can't seem to figure out how to find the Name column from the Geometry1 data. As in I want to get "RelLineTo" as output for instance so I know if to draw a straight line or a ellipse for instance in other programs.
UPDATE (code snippet on how I try to translate the suggestion from John:
var firstComponent = (short)Visio.VisSectionIndices.visSectionFirstComponent;
var selection = Globals.ThisAddIn.Application.ActivePage.CreateSelection(VisSelectionTypes.visSelTypeByLayer, VisSelectMode.visSelModeSkipSuper, Globals.ThisAddIn.Application.ActivePage.Layers.ItemU[areaLayer]);
foreach (Visio.Shape shape in selection)
{
for (short s = firstComponent; s < firstComponent + shape.GeometryCount; s++)
{
var geoSection = shape.Section[s];
for (short r = 1; r < geoSection.Count - 1; r++) // First and last point is always the same
{
var pointType = shape.RowType[s, r];
var pointTyp = Enum.GetName(typeof(Visio.VisRowTags),pointType);
}
}
}
This is the code I use to find all my X and Y values, apart from that last bit with var pointType/pointTyp. Would be logical if I could get the row-info from within the same for loops, wouldn't it? Can't
