Get the parent shape (Group)

Hi,


Thanks for all the helps that you gave us in all aspose components (Word,Cells,Diagram…)

This time we have a little bit an issue with the relationship parent-child between shapes.
It’s easy to get the sub-shapes through the method GetShapes but we have a little problem getting the other way around.

for a giving shape we need to check if it’s in a group and most important the parent shape.

is there a way to do that ?

Thanks in advance.

Hi Achraf,


Thank you for contacting Aspose support.

I am afraid, the current set of the Aspose.Diagram APIs do not offer the means to get the group or the parent of a given shape. I have logged both feature requests in our database for feasibility analysis. Once we have completed the preliminary investigation, we will share the estimated release schedule for the implementation. Please find the ticket details for your future reference as follow.

  • DIAGRAMNET-51143: Ability to get the group of a shape.
  • DIAGRAMNET-51144: Ability to get the parent of a shape.

Hi again,


This is to update you that both tickets attached to this thread have been marked resolved. We will share the required enhancements with next revision of the API in couple of days.

The issues you have found earlier (filed as DIAGRAMNET-51143;DIAGRAMNET-51144) have been fixed in Aspose.Diagram for .NET 17.02.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hello,


The correction that you provide us is working perfectly. Thank you for the good work.


In a related subject, we are looking for a way to directly get a sub-shape by Id.

when we are using the code below to retrieve connectors, the Ids givens sometimes are related to some sub-Shape elements.

for (Connect connector : (Iterable) vdxDiagram.getPages().get(0).getConnects()) {
// Display information about the Connectors
System.out.println("\nFrom Shape ID : " + connector.getFromSheet());
System.out.println(“To Shape ID : " + connector.getToSheet());
}

the method connector.getFromSheet() method gives us an ID. I f we use the method below to retrieve it, it won’t work simply because this ID is one of a sub-Shape.

vdxDiagram.getPages().get(0).getShapes().getShape(connector.getFromSheet())

In the attached file you will find a visio file where the code below won’t work simply because the ID given can’t be retrieved correctly.

for (Connect connector : (Iterable) vdxDiagram.getPages().get(0).getConnects()) {
// Display information about the Connectors
System.out.println(”\nFrom Shape ID : " + connector.getFromSheet());
System.out.println(“To Shape ID : " + connector.getToSheet());
System.out.println(“eeee” + vdxDiagram.getPages().get(0).getShapes().getCount());
System.out.println(”\nFrom Shape ID : " + RetriveConnector.getName(vdxDiagram.getPages().get(0).getShapes().getShape(connector.getFromSheet())));
System.out.println(“To Shape ID : " + RetriveConnector.getName(vdxDiagram.getPages().get(0).getShapes().getShape(connector.getToSheet())));
System.out.println(”--------------------------------------------------------------------");
}

Is there way to get it directly without doing a full search for all the shapes the n the subshapes to get it.

Hi Achraf,


Thank you for the inquiry. There is no direct way to retrieve the sub shape. You can iterate through the sub shapes recursively. In this help topic, we are iterating through each sub-shape to retrieve the plain text: Extract Plain Text of the Visio Diagram Page