参照官方提供的HorizontalAlignmentCreator例子尝试去构建一个Alignment,代码如下:
public
static
void
CreateAlignmentFromPoints(List<EXPoint3d> m_points)
{
string
m_featureDef =
""
;
m_featureName =
List<LinearElement> lines =
new
List<LinearElement>();
if
(m_points.Count < 2)
return
}
//adjusts x and y values
double
UorPerMas = 1;
DPoint3d startPoint =
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 =
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(),
false
,
, 0.001);
ConsensusConnectionEdit con = ConsensusConnectionEdit.GetActive();
con.StartTransientMode();
Alignment al = con.GetActiveGeometricModel().CreateAlignmentByLinearElement(complexAlign,
true
);
con.PersistTransients();
//sets feature definition and feature name
(m_featureName !=
null
&& m_featureName !=
.Empty && m_featureDef !=
&& m_featureDef !=
.Empty)
al.SetFeatureDefinition(m_featureDef, m_featureName);
else
(m_featureDef !=
al.SetFeatureDefinition(m_featureDef);
在调试的时候,在运行CreateAlignmentByLinearElement时ORD崩溃了:
看了下exception.log日志,也没发现什么问题:
日志里面的CREATEMODELTEST TESTALIGNMENTFUNCTIONS就是调用构建Alignment函数的命令。