Free Support Forum - aspose.com

Aspose .NET API for visio info extraction

or a specific use case we were evaluating Aspose API for .NET

Our use case circle arounds VISIO diagram and hence we are using Diagram library specifically.

However, on the trail version, we are not able to extract all the relevant information that we need. Before we move for a licensed version, would like to know from you whether our those can be extracted to support our use case. Would love to get in a call with you to discuss in more details

Issues:

  1. Not able to get the Lane and Pool information for a specific shape.Which method to be used ?
  2. Getting connected images however if a process is connected to a control, not able to find the connection
  3. Diagram.Pages[0].Connects is showing the list on runtime however , the .List property is inaccessible.
  4. Not able to get the Controls associated with a process.
    Reference visio image:
    image.png (21.8 KB)

Let me know if these information can be extracted along with all the related information of a shape.
Can we test this extraction in the trial version.

@prasenjeit

Thanks for showing interest in our API.

Would you please share your sample Diagram file with us. We will test the scenario in our environment and address it accordingly.

Please find the attached visio. My requirement is to

  1. Identify the correct shape types like Process /Process Reference/ Gateway/Control/Event
  2. Get the Metadata of the shapes like Text, ID, Location Co-Ordinates
  3. Which shapes belongs to which Lane or Pool. e.g Lane1 belongs to Pool1. Process Step 3 Belongs to Lane 2 like this
    4.Connections. From and To Shapes for connections and Text (if any on that connection)
  4. Connection between a Control Shape and a Process like Shape 11 connected to Control 1
  5. Connection between Application Shape and Process like ABC connected to Shape 11
  6. Gateway type (like exclusive/parallel) and even type (start/end /intermediate)

Let me know if you need any more information from my end.

Thanks,
PrasenjeetSample Diagram.zip (374.0 KB)

@prasenjeit

Thanks for providing sample diagram.

For your above requirements, you may please use the following code snippet and share with us if this fulfills what you need:

// Call a Diagram class constructor to load the VSDX diagram
Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram(dataDir + "Example.vsdx");
// Get page by name
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1");
foreach(Aspose.Diagram.Shape s in page.Shapes)
{
 var text = s.Text;
 var ID = s.ID;
 var locx = s.XForm.PinX;
 var locy = s.XForm.PinY;
 long[] In_connectedShapeIds = s.ConnectedShapes(Aspose.Diagram.ConnectedShapesFlags.ConnectedShapesIncomingNodes, null);
 long[] Out_connectedShapeIds = s.ConnectedShapes(Aspose.Diagram.ConnectedShapesFlags.ConnectedShapesOutgoingNodes, null);
}

Regarding these requirements, an investigation ticket has been logged as DIAGRAMNET-51818 in our issue tracking system. We will look into details of it and share our feedback with you as soon as it is resolved. Please spare us some time.

Thanks team for the prompt response and sharing the code snippet.
From the given code, the relation between shapes to shapes(1st Point), I am able to however the control and application relationship is still not coming up (2nd and 3rd points). Am I missing something.

@prasenjeit

We have logged your concern along with the ticket and will share our feedback with you as soon as the ticket is resolved. Please spare us some time.

Team can you atleast help me with some code samples for

  1. Getting the event type
    2.Getting the Gatewaytype and
    3.Finding out which shapes are present is a respective Swimlanes

Thanks in advance

@prasenjeit

Thanks for getting back to us.

We will surely take care of your request as soon as the ticket is investigated. We will share our feedback soon against your requirements. Please spare us some time.

Team do we have any update on this.If you kindly let me know how can we get the Container shapes and the shapes inside it to start with. For example a swimlane has which shapes inside it.

A sample code will really be helpful.

Thanks,
Prasenjeet

@prasenjeit

There is no particular information in the source Visio file that you have shared. However, you can get Shape information according to its name. About finding out which shapes are present in a respective Swimlanes, please try this sample code:

var srcPage = diagram.Pages.GetPage("Page-1");
var shape = srcPage.Shapes.GetShape("Pool / Lane");
ShapeCollection childs = shape.Shapes;

Thanks for the quick response but this code is not giving me the right output:
However , The this piece of code can be used with some text cleaning and reference id

var test = vdxDiagram.Pages[0].Shapes[i].Layout.Relationships.Ufe.F;
Console.WriteLine(“aspose—” + test);
Please try the above code and let me know

By the way can team help me to tell how can I identify the type of Gateway like Parallel, Inclusive etc. from the shape if it is a Gateway.
Similarly how can I get kind of event type.
This would be really helpful. Thanks in advance.

Prasenjeet

@prasenjeit

We have logged your response under the attached ticket and will share our feedback as soon as the ticket is investigated accordingly. Please spare us some time.

OK.
I am using Aspose Visio DLL from Visual Studio Nuget.
Is there any subscription needed for it. Will it get expired. What is the way of renewal ?

Also … is there any way I can know what kind of Gateway type and event type.

@prasenjeit

We are investigating your this requirement and will share our feedback as soon as the logged ticket is resolved.

In order to use API in its full capacity, you need to set a valid license before using any method or functionality of the API. You can also evaluate API without trial version limitation by using 30-days free temporary license. As far as usage of trial version is concerned, you can use it as long as you want. For furhter inquiries related to API purchase, you can please contact our sales team.

Is there any update. and
if team can help me in this question atleast:
What is the way I can read the shapes inside a groupshape in visio . Please

Prasenjeet

read the shapes inside a groupshape in visio, I have tried Shape.Shapes for the group but count is coming as zero all the time.

Other thing is that I am trying to get the connected shapes for text annotation.
Tried two methods, 1) shape.GluedShapes(GluedShapesFlags.GluedShapesAll2D, “”, null).Count()
and 2) shape.IsConnected(shp). No way I am able to find a solution. Attaching the sample Visio for your refernce. Any help will be highly appreciated. Based on these answers. we will decide to procure the license.

Thanks,
Prasenjeet

Sample Diagram -test.zip (368.6 KB)

@prasenjeit

Regarding your gateway requirements, please try following code:

//gateway
Shape shape = diagram.Pages[0].Shapes.GetShape(340);
String gatewayType = shape.Props.GetProp("BpmnGatewayType").Value.Val;
Console.WriteLine(gatewayType);
//event             
foreach (Shape child in diagram.Pages[0].Shapes)
{                
 if (child.Name.IndexOf("Event") != -1)
 {                   
   Console.WriteLine(child.Name);                
 }            
} 

We are checking for this scenario and will share our feedback with you shortly.

1 Like

Thanks Team, Please help me with the
1.to find shapes under Group Shape and
2. the connected shapes for text annotation.
I would be having an important demo with the stakeholder

Thanks in advance,
Thanks,
Prasenjeet

@prasenjeit

We have checked your sample file and we could see that shape432 and shape401 is connected in the sample file. Please try using following code snippet:

Shape shape = diagram.Pages[0].Shapes.GetShape(432);
Shape sh = diagram.Pages[0].Shapes.GetShape(401);
long[] In_connectedShapeIds = shape.ConnectedShapes(ConnectedShapesFlags.ConnectedShapesIncomingNodes, null);
long[] Out_connectedShapeIds = shape.ConnectedShapes(ConnectedShapesFlags.ConnectedShapesOutgoingNodes, null);
Console.WriteLine("Shape ID: " + shape.ID + "\t Name: " + shape.Name + "\t\t Incoming nodes count: " + In_connectedShapeIds.Length + "\t\t Outgoing nodes count: " + Out_connectedShapeIds.Length);            
Console.WriteLine(In_connectedShapeIds[0]);            
bool isConn = shape.IsConnected(sh);            
Console.WriteLine(isConn);