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

 

Vecad控件添加样条曲线(Spline)_第1张图片

 

 

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

Value Fit type
CAD_PLINE_LINEAR Direct lines or arcs between vertices.
CAD_PLINE_QUAD Quadratic B-spline.
CAD_PLINE_CUBIC Cubic B-spline.
CAD_PLINE_BEZIER Bezier curve.
CAD_PLINE_SPLINE Cubic spline goes through vertices.
CAD_PLINE_ROUND Cubic spline goes through vertices.
CAD_PLINE_LINQUAD Combination of linear segments and quadratic B-spline segments.

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

你可能感兴趣的:(VB,VBA)