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

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/hjpqindong/article/details/4359109

更多文章请访问: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_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.

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

展开阅读全文

没有更多推荐了,返回首页