VectorDraw Developer Framework试用版下载
点开本篇文章,是否对矢量图形工具感兴趣呢看看最新的矢量图形工具测评吧!点击此处>>即可直达哦!
问:
我正在创建带有某些顶点的折线,并希望使用FilletRadiousAtIndex方法对圆角进行切角,例如段0、1和2,但是我的代码无法正常工作。我怎样才能做到这一点 /p>
答:
FilletRadiousAtIndex方法如果成功,则将向折线添加一个新顶点,并且(可能是封闭的)它也可能改变点的顺序。因此,像您发送的代码那样的代码将无法工作,因为首次调用FilletRadiousAtIndex会改变点的顺序,因为需要添加新的点,因此,您不能使用像这样的代码:
poly.FilletRadiusAtIndex(radious,0);poly.FilletRadiusAtIndex(radious,1);poly.FilletRadiusAtIndex(radious,2);
您需要遵循以下代码中的其他方法,请参见以下代码:
private void button5_Click(object sender, EventArgs e){ vdDocument doc = vdFramed1.BaseControl.ActiveDocument; doc.New(); doc.ZoomWindow(new gPoint(0, -10), new gPoint(240, 240)); Vertexes verts = new Vertexes(); verts.Add(40, 0, 0, 0); verts.Add(40, 200, 0, 0); verts.Add(20, 180, 0, 0); verts.Add(20, 230, 0, 0); verts.Add(200, 230, 0, 0); verts.Add(200, 180, 0, 0); verts.Add(180, 200, 0, 0); verts.Add(180, 0, 0, 0); vdPolyline poly = new vdPolyline(doc, verts); doc.Model.Entities.AddItem(poly); poly.Flag = VectorDraw.Professional.Constants.VdConstPlineFlag.PlFlagCLOSE; poly.Update(); double R1 = 9.0d; double R2 = 6.0d; double R3 = 3.0d; // alter these as you like gPoints pts_to_Fillet = new gPoints(); // to keep the “original” indexes that you need to fillet pts_to_Fillet.Add(new gPoint(poly.VertexList[0] as gPoint));// pt 0 -> R1 pts_to_Fillet.Add(new gPoint(poly.VertexList[2] as gPoint));// pt 1 -> R2 pts_to_Fillet.Add(new gPoint(poly.VertexList[3] as gPoint));// pt 2 -> R3 pts_to_Fillet.Add(new gPoint(poly.VertexList[4] as gPoint));// pt 3 -> R3 pts_to_Fillet.Add(new gPoint(poly.VertexList[5] as gPoint));// pt 4 -> R2 pts_to_Fillet.Add(new gPoint(poly.VertexList[7] as gPoint));// pt 5 -> R1 for (int i = 0; i < pts_to_Fillet.Count; i++) { double radious = 9.0; if (i == 0 || i == 5) radious = R1; else if (i == 1 || i == 4) radious = R2; else if (i == 2 || i == 3) radious = R3; int index_pl = poly.VertexList.FindVertexPoint(pts_to_Fillet[i]); // get the new index of the previously stored if (index_pl > -1) { poly.FilletRadiusAtIndex(radious, index_pl); // and fillet it poly.Update(); } else MessageBox.Show("point not found on polyline"); } poly.Invalidate();}
对于以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。
相关资料推荐:
-
如何排除GroundSurface对象的三角形区域/strong>
-
复杂自定义对象的入门指南
-
点击此处还有VectorDraw Developer Framework的demo示例等着你来体验哦!
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!