【ORD C#】Profile控制点如何获取?

老师你好,我通过路线获取到一条复合的纵断面,我尝试这用GetHorizontalControlPoints获取控制点,不知是否正确

  • 这个是获取横断面控制点的,您应该用GetVerticalControlPoints方法获取纵断面的。

  • 以下是我写的代码,有两个问题

    1. GetVerticalControlPoints的参数不知如何选择

    2.GetVertices()是得到所有控制点吗

    Profile profile = al.ActiveProfile;
    ProfileElement profileGeometry =profile.ProfileGeometry;
    CurveVector curveVector = profileGeometry.GetCurveVector();
    LinearElement linear = LinearElement.CreateFromCurveVector(curveVector, true);
    LinearPointCollection coll = linear.GetVerticalControlPoints(VerticalControlPointTypes.Curve_Line);
    DPoint3d[] pts = coll.GetVertices();

  • 1.具体设置参数我找到C++的,.net没有封装那么多,但基本都在C++有介绍,里面对每个参数都有解释:

    public enum class VerticalControlPointTypes : int
    {
        /// High point in profile.
        /// </summary>
        High_Point = BC_VERT_CTRLPT_VHP,
        /// <summary>
        /// Low point in profile.
        /// </summary>
        Low_Point = BC_VERT_CTRLPT_VLP,
        /// <summary>
        /// Start point and end point in profile.
        /// </summary>
        StartEnd_Point = BC_VERT_CTRLPT_VPI,
        /// <summary>
        /// Point of intersection for curve.
        /// </summary>
        Curve_PI = BC_VERT_CTRLPT_VC_VPI,
        /// <summary>
        /// Connection point of line and curve.
        /// </summary>
        Line_Curve = BC_VERT_CTRLPT_VC_VPC,
        /// <summary>
        /// Connection point of curve and line.
        /// </summary>
        Curve_Line = BC_VERT_CTRLPT_VC_VPT,
        /// <summary>
        /// Point of intersection for sag curve.
        /// </summary>
        SagCurve_PI = BC_VERT_CTRLPT_VC_VPI_SAG,
        /// <summary>
        /// Point of intersection point for crest curve.
        /// </summary>
        CrestCurve_PI = BC_VERT_CTRLPT_VC_VPI_CST,
        /// <summary>
        /// Connection point of line and sag curve.
        /// </summary>
        Line_SagCurve = BC_VERT_CTRLPT_VC_VPC_SAG,
        /// <summary>
        /// Connection point of line and crest curve.
        /// </summary>
        Line_CrestCurve = BC_VERT_CTRLPT_VC_VPC_CST,
        /// <summary>
        /// Connection point of sag curve and line.
        /// </summary>
        SagCurve_Line = BC_VERT_CTRLPT_VC_VPT_SAG,
        /// <summary>
        /// Connection point of crest curve and line.
        /// </summary>
        CrestCurve_Line = BC_VERT_CTRLPT_VC_VPT_CST,
    };
    

    2.当您获取LinearPointCollection 您可以遍历该数组,获取每个LinearPoint ,GetVertices是获取每个顶点,也就是您数组里面的点坐标(DPoint3d):

    foreach(LinearPoint lp in linearPtCollection)

    Answer Verified By: XiaoHu 

  • 感谢老师解答,按照你给的linearPtCollection遍历方式去获取控制点,我把所有的VerticalControlPointTypes类型都试了一遍,发现遍历结果都为空

  • 您把模型给我发下邮箱:xiaoqi.zhang@bentley.com,您是要获取模型某一条alignment的profile的控制点是吗?邮箱给我说明下,谢谢。