CurveExample shows how to get a primitive curve or a curvevector from an element with curve geometries.
This example provides two tools:
-
Primitive Curve Example: This example shows how to use LocateSubEntityTool to get primitive curve from a curve element or an edge on a solid element. The example also shows how to use some methods in CurvePrimitive.h header file with a method named UsingPrimitiveCurveMethods(). The base class LocateSubEntityTool populates the primitive curve from an Element into a memory cache which can be gotten by using GetAcceptedSubEntities(). The sub-class method GetEdgePrimitiveCurve() is responsible for getting the required primitive curve by converting the ISubEntityPtr to a primitive curve.
-
Curve Vector Example: This example shows how to use ElementGraphicsTool to get curveVector from an element with curve geometries and how to use the frequently used methods in CurveVector.h header file in UsingCurveVectorMethods(). The base class populates the geometry of an Element into a memory cache which can be identified by the selected element id. The sub-class is responsible for getting the required geometry type using the TryGetAs*() methods.The sub-class also can use 5 _OnProcess* () to tell the base class ElementGraphicsTool to filter the geometry type.
This example provides the following key-ins:
-
EXAMPLE ELEMPRIMCURVER: Shows how to get a primitive curve (represented by class ICurvePrimitive), and how to use the methods in ICurvePrimitive.
-
EXAMPLE ELEMCURVEVECTOR: Shows how to get a curvevector class (representation of a collection of primitive curves) and how to uses the methods in CurveVector.
The Dgn File CurveExample.dgn provided with this example can be used with the example key-ins.