Vecad控件添加样条曲线(Spline)

更多文章请访问:http://www.SurMap.com

 

vecad控件中添加样条曲线需要使用到三个函数:

AddVertex、ClearVertices、AddPolyline

在创建样条曲线前需要将样式曲线的各个节点用AddVertex依次添加,然后用AddPolyline创建样条曲线:

Vecad1.AddVertex 0, 0, 0
Vecad1.AddVertex 2, 2, 0
Vecad1.AddVertex 10, 10, 0
Vecad1.AddVertex 15, 6, 0
Vecad1.AddVertex 10, 3, 0
Vecad1.AddVertex 20, 1, 0
Vecad1.AddPolyline CAD_PLINE_ROUND, 0
Vecad1.Update
在创建下一条曲线前需要用ClearVertices清空顶点列表:

Vecad1.ClearVertices
Vecad1.AddVertex 0, 0, 0
Vecad1.AddVertex 2, 2, 0
Vecad1.AddVertex 10, 10, 0
Vecad1.AddVertex 15, 6, 0
Vecad1.AddVertex 10, 3, 0
Vecad1.AddVertex 20, 1, 0
Vecad1.AddPolyline CAD_PLINE_SPLINE, 0
Vecad1.Update

 

 

 

AddPolyline第一个参数的取值见下表:

ValueFit type
CAD_PLINE_LINEARDirect lines or arcs between vertices.
CAD_PLINE_QUADQuadratic B-spline.
CAD_PLINE_CUBICCubic B-spline.
CAD_PLINE_BEZIERBezier curve.
CAD_PLINE_SPLINECubic spline goes through vertices.
CAD_PLINE_ROUNDCubic spline goes through vertices.
CAD_PLINE_LINQUADCombination of linear segments and quadratic B-spline segments.

不同参数的效果请自行实验。

©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页