We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Loop through node collection to retrive the start and end point of all lines.

Thread ID:

Created:

Updated:

Platform:

Replies:

124622 Jun 18,2016 03:21 PM UTC Jun 21,2016 06:43 AM UTC WinForms 3
loading
Tags: Diagram
Sérgio Rodrigues Costa
Asked On June 18, 2016 03:21 PM UTC

loop through node collection to retrive the start and end point of all lines.
I need to export these points to a list of X, Y values as coordinates.
I´m using visual basic, so, it you guys can help me I´ll appreciate.

Thanks.

Naganathan Ganesh Babu [Syncfusion]
Replied On June 20, 2016 05:31 AM UTC

Hi Sergio, 
 
Thanks for contacting Syncfusion support. 
 
We have created a sample to achieve your requirement. We suggest you to use Connector’s “GetPoints()” method to get all points of the connectors. Please refer to the below code example and sample. 
 
Code example: 
 
[C#] 
 
Dictionary<string, PointF[]> points = new Dictionary<string, PointF[]>(); 
foreach (Node node in diagram1.Model.Nodes) 
{ 
if (node is ConnectorBase) 
{ 
PointF[] pts = (node as ConnectorBase).GetPoints(); 
points.Add(node.Name, pts); 
} 
} 
 
Sample: 
 
 
Regards, 
 
Naganathan K G 


Sérgio Rodrigues Costa
Replied On June 20, 2016 11:28 AM UTC

I´m sorry if I was not clear enough.
My goal is to translate the diagram to a DXF file, so I have to find out a way to translate at least Rectangles (done ), Text (done), lines (not done yet) and Circles (not done yet).

The sample code that you sent me, its getting similar results to the one I was using. 
Please refer to my attached file to see the results of a simple LineConnector with your sample code.I´m not getting a coordinates pair.

I tought i supposed to get  two coordinates (x,y) from start point and (x1,y1) for the end point.
Thanks again!

Attachment: coordinates_217f3a04.zip

Naganathan Ganesh Babu [Syncfusion]
Replied On June 21, 2016 06:43 AM UTC

Hi Sergio, 
 
Please confirm us whether your requirement is to get the start point and end point of the connector alone? If yes, please use TailEndPoint’s and Headpoint’s “Location” property to get the start and end points of the connector. If we misunderstood your requirement, please share us more information about your requirement probably a code example on how you are getting and saving the diagram’s Rectangle/Text nodes location on the DXF file in your environment, which will help us to analyze further and provide you a better solution. 
 
Also refer to the below attached modified sample and code example: 
 
Code example: 
 
[VB] 
 
Dim line As New LineConnector(New PointF(100, 100), New PointF(200, 100)) 
diagram1.Model.AppendChild(line) 
Dim points As New Dictionary(Of String, PointF())() 
For Each node As Node In diagram1.Model.Nodes 
If TypeOf node Is ConnectorBase Then 
Dim pts(1) As PointF 
'Start point 
pts(0) = (TryCast(node, ConnectorBase)).TailEndPoint.Location 
'End point 
pts(1) = (TryCast(node, ConnectorBase)).HeadEndPoint.Location 
points.Add(node.Name, pts) 
End If 
Next node 
 
Sample: 
 
 
Regards, 
 
Naganathan K G 
 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;