Python

Introduction to the CurveVector Class

MicroStationAPI Documentation

A CurveVector is an in-memory abstraction of one or more DGN linear elements. Here's what the MicroStationAPI help documentation tells us about it …

A CurveVector is a collection of curve primitives.

The collection has a type code that indicates whether it acts as an open chain, single loop (inner or outer), or a parent of multiple loops.

This can represent paths, loops, multiloop parity regions, and multi-region collections.

Example tree structures for CurveVector

Parity Regions

A parity region is a collection of unordered loops. A point moving in the plane transitions from "in" to "out" (or vice versa) any time it crosses a curve.

This definition of inside and outside is well defined even if (a) the loops cross each other, (b) self-intersection within a loop, (c) any order of presentation of the loops.

In the usual case where there is a single outer loop and one or more hole loops, it is customary to store the outer loop first followed by holes, with the outer loop counterclockwise and inner loops clockwise.

Warning: Computational code that requires signed loops (e.g. area calculations) assumes that the largest loop is outer and others are inner.

Using the CurveVector Class

One way to use the CurveVector class to handle a single DGN primitive (e.g. a LineElement) is …

Expressing the above in code …

EditElementHandle eeh = # get an element

cv: MSPyBentleyGeom.CurveVector = ICurvePathQuery.ElementToCurveVector(eeh)

# do something with CurveVector
 …
# create a new element from the modified CurveVector
DraftingElementSchema.ToElement(eeh, cv)

Questions

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