目前的二次开发中使用比较多的是AcDbPolyline(OdDbPolyline)也就是轻量多段线,虽然在CAD中绘制轻量多段线,选中之后右键菜单编辑可以进行“曲线拟合”、“样条曲线化”……等操作,但是在代码中并没有AcDbPolyline可以直接调用的函数进行曲线拟合,需要我们先转换为二维多段线(AcDb2dPolyline)然后才能调用曲线拟合的函数。
先说转换二维多段线的接口“convertTo”:ARX中第一个参数二维多段线只需要定义出指针就可以了,第二个参数默认为true。
详细参考如下:
Acad::ErrorStatus convertTo(
AcDb2dPolyline*& pPline,
Adesk::Boolean transferId = Adesk::kTrue) const;
Parameters
AcDb2dPolyline*& pPline
Output pointer to be set to point to the newly created AcDb2dPolyline
Adesk::Boolean transferId = Adesk::kTrue
Input Boolean indicating whether or not to do a handOverTo between the AcDbPolyline and the AcDb2dPolyline.
Description
This function creates an AcDb2dPolyline from the AcDbPolyline and sets pPline to point to the newly created AcDb2dPolyline.
If transferId is Adesk::kTrue, the newly-created AcDb2dPolyline