在ORDChina使用C#构建Alignment时报错

参照官方提供的HorizontalAlignmentCreator例子尝试去构建一个Alignment,代码如下:

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
38
39
40
41
        public static void CreateAlignmentFromPoints(List<EXPoint3d> m_points)
        {
            string m_featureDef = "";
            string m_featureName = "";
            List<LinearElement> lines = new List<LinearElement>();
            if (m_points.Count < 2)
            {
                return;
            }
            //adjusts x and y values
            double UorPerMas = 1;
            DPoint3d startPoint = new DPoint3d(m_points[0].X, m_points[0].Y, m_points[0].Z);
            startPoint.X *= UorPerMas;
            startPoint.Y *= UorPerMas;
            startPoint.Z *= UorPerMas;
            for (int i = 1; i < m_points.Count; i++)
            {
                DPoint3d endPoint = new DPoint3d(m_points[i].X, m_points[i].Y, m_points[i].Z);
                endPoint.X *= UorPerMas;
                endPoint.Y *= UorPerMas;
                endPoint.Z *= UorPerMas;
                //creates a line between each consectutive pair of points
                Line line = Line.Create1(startPoint, endPoint);
                lines.Add(line);
                startPoint = endPoint;
            }
            LinearComplex complexAlign = LinearComplex.Create1(lines.ToArray(), falsefalse, 0.001);
            ConsensusConnectionEdit con = ConsensusConnectionEdit.GetActive();
            con.StartTransientMode();
            Alignment al = con.GetActiveGeometricModel().CreateAlignmentByLinearElement(complexAlign, true);
            con.PersistTransients();
            //sets feature definition and feature name
            if (m_featureName != null && m_featureName != string.Empty && m_featureDef != null && m_featureDef != string.Empty)
            {
                al.SetFeatureDefinition(m_featureDef, m_featureName);
            }
            else if (m_featureDef != null && m_featureDef != string.Empty)
            {
                al.SetFeatureDefinition(m_featureDef);
            }
        }

在调试的时候,在运行CreateAlignmentByLinearElement时ORD崩溃了:

看了下exception.log日志,也没发现什么问题:

日志里面的CREATEMODELTEST TESTALIGNMENTFUNCTIONS就是调用构建Alignment函数的命令。

Parents Reply Children
No Data