Python

Introduction to the CurveLocationDetail class

Introduction

A CurveVector is an in-memory abstraction of one or more DGN linear elements. You can enumerate points along a CurveVector. At each point you can obtain a CurveLocationDetail instance. CurveLocationDetail contains the information to extract the 3D point coordinates and the tangent vector at each point.

Using the CurveLocationDetail class

You might convert a DGN elemente to a CurveVector, then enumerate points along that CurveVector. At each point you will receive a CurveLocationDetail instance.

Example: Place Cells along Line

I wrote an example Python app. that shows how to …

It uses CurveLocationDetail in the cell placement logic to calculate the tangent points along the line. Using that tangent, it can place a cell rotated to align with the line. Here's a function that extracts the tangent, expressed as a rotation matrix, at a point …

def get_tangent_at_point(detail: CurveLocationDetail)->RotMatrix:
    ''' Compute the tangent at a point on a line and return its orientation as a rotation matrix. '''
    vr: ValidatedDRay3d = detail.PointAndUnitTangent()
    ray: DRay3d = vr.Value()
    direction: DVec3d = ray.direction
    x_axis = DVec3d.From (1.0, 0.0, 0.0)
    angle = direction.AngleToXY(x_axis)
    _Z_AXIS = 2
    rotation = RotMatrix.FromAxisAndRotationAngle(_Z_AXIS, angle)
    return rotation

Questions

Post questions about MicroStation Python programming to the MicroStation Programming Forum.