GetEndPoints() / GetAllPoints() Method in SolidEdgeAssembly.Path

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer

Hello,
I'm working in wire harness paths.
I want to get the startpoint and the end point for the path so I'm using GetEndPoints(Array positionpoint).
I'can not see the type of the positionpoint.

Array positionpoint = Array.CreateInstance(typeof(double),10);

I'm tried this above but this does not return coordinate for a point.
How can i work with path.GetEndPoints() /path.GetAllPoints()?

best regards.
Amani

1 REPLY

Re: GetEndPoints() / GetAllPoints() Method in SolidEdgeAssembly.Path

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Hi @Ameni,

To get the startpoint and the end point of a path you can use "GetEndPoints" method as shown below.

To use this code,

1. Create a C# ConsoleApplication.

2. Add reference of SE Assembly type library.

3. Create/Open an assembly file containing harness path in SE.

4. Run this code.

 

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Xml.Linq;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application objApp = null;
            SolidEdgeAssembly.AssemblyDocument objDoc = null;
            SolidEdgeAssembly.Paths objpaths = null;
            SolidEdgeAssembly.Path objpath = null;
            Array arrEndPointPositions = Array.CreateInstance(typeof(double), 10);

            try
            {
                objApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
                objDoc = (SolidEdgeAssembly.AssemblyDocument)objApp.ActiveDocument; // Active document must contain a path
                objpaths = objDoc.Paths;
                objpath = objpaths.Item(1);
                objpath.GetEndPoints(ref arrEndPointPositions);
                

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

        }
    }
}