-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVertexUtility.cs
37 lines (32 loc) · 1.43 KB
/
VertexUtility.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TopologyTraverseByAPI
{
public class VertexUtility
{
public interop.CimBaseAPI.ICimEntityList GetConnectedEdges(interop.CimBaseAPI.ICimEntity iVertex)
{
interop.CimBaseAPI.IEntityQuery aVertexQuery = (interop.CimBaseAPI.IEntityQuery)iVertex;
interop.CimBaseAPI.IEntityFilter aEdgeEntityFilter = aVertexQuery.CreateFilter(interop.CimBaseAPI.EFilterEnumType.cmFilterEntityType);
interop.CimBaseAPI.FilterType aIEdgeFilter = (interop.CimBaseAPI.FilterType)aEdgeEntityFilter;
aIEdgeFilter.Add(interop.CimBaseAPI.EntityEnumType.cmEdge);
aVertexQuery.SetFilter((interop.CimBaseAPI.IEntityFilter)aIEdgeFilter);
interop.CimBaseAPI.ICimEntityList aEdgeList = aVertexQuery.Select();
return aEdgeList;
}
public double[] GetVertexLocation(interop.CimBaseAPI.ICimEntity iVertex)
{
interop.CimBaseAPI.IGeometry3D aGeom = iVertex.Geometry;
if (aGeom.Type== interop.CimBaseAPI.GeomType.cmGeomPoint)
{
interop.CimServicesAPI.IGeom3DPoint aPoint = (interop.CimServicesAPI.IGeom3DPoint)aGeom;
double[] aPointData = { aPoint.X, aPoint.Y, aPoint.Z };
return aPointData;
}
return null;
}
}
}