翻译|使用教程|编辑:况鱼杰|2019-11-12 13:59:56.810|阅读 277 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常见问题,教程整理的很齐全,非常适合新手学习。本文将会介绍工程图后如何重新读取对象的几何特性(gPoints)。
# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>
相关链接:
VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。
VectorDraw Developer Framework试用版下载
问:
工程图后如何重新读取对象的几何特性(gPoints)?
答:
您可以使用以下代码:
private void ReadProps() { string msg = ""; System.Diagnostics.Debug.WriteLine("=====START===="); foreach (vdFigure item in vdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Entities) { if (item is vdLine) {//vdLine's geometry is defined by two gPoints; the StartPoint and the EndPoint// vdLine line = item as vdLine; msg = "vdLINE StartPoint: " + line.StartPoint.ToString() + " EndPoint: " + line.EndPoint.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vdPolyline) {//vdpolyline's geometry is defined by the VertexList which is a collection of points (Vertex)// vdPolyline polyline = item as vdPolyline; msg = "vdPOLYLINE VertexList: " + polyline.VertexList.ToString()+ "\r\n"; foreach (Vertex item2 in polyline.VertexList) { msg += item2.ToString() + "\r\n"; } System.Diagnostics.Debug.WriteLine(msg); } if (item is vdCircle) {//vdCircle's geometry is defined by the Center point and the Radius// vdCircle circle = item as vdCircle; msg = "vdCIRCLE Center: " + circle.Center.ToString() + " Radius: " + circle.Radius.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vdRect) {//vdRect's geometry is defined by the InsertionPoint and the Width// vdRect rect = item as vdRect; msg = "vdRECT Insertion Point: " + rect.InsertionPoint.ToString() + " Width: " + rect.Width.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vdArc) {//vdArc's geometry is defined by the Center point, the Radius, the StartAngle and the EndAngle// vdArc arc = item as vdArc; msg = "vdARC Center Point: " + arc.Center.ToString() + " Radius: " + arc.Radius.ToString() + " StartAngle: "+ arc.StartAngle.ToString() + " EndAngle: " + arc.EndAngle.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vdEllipse) {//vdEllipse's geometry is defined by the Center point the StartAngle,the EndAngle, // the MajorAngle, MajorLength and the MinorLength// vdEllipse ellipse = item as vdEllipse; msg = "vdELLIPSE Center Point: " + ellipse.Center.ToString() + " StartAngle: " + ellipse.StartAngle.ToString() + " EndAngle: " + ellipse.EndAngle.ToString() + " MajorAngle: " + ellipse.MajorAngle.ToString() + " MajorLength: " + ellipse.MajorLength.ToString() + " MinorLength: " + ellipse.MinorLength.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vdText) {//vdText's "geometry" is defined by the InsertionPoint, the Height and the Rotation// vdText text = item as vdText; msg = "vdTEXT Insertion Point: " + text.InsertionPoint.ToString() + " Heihgt: " + text.Height.ToString() + " RotationAngle: "+text.Rotation.ToString() + " Text: " + text.TextString.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vdMText) {//vdMText's "geometry" is defined by the InsertionPoint and the Height// vdMText mtext = item as vdMText; msg = "vdMTEXT Insertion Point: " + mtext.InsertionPoint.ToString() + " Heihgt: " + mtext.Height.ToString() + " Text: " + mtext.TextString.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vdInfinityLine) {//vdInfinityLine's geometry is defined by the BasePoint and the Direction// vdInfinityLine xline = item as vdInfinityLine; msg = "vdXLINE Base Point: "+xline.BasePoint.ToString()+" Direction: "+ xline.Direction.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vdPolyface) {//vdPolyface's geometry is defined by the VertexList which is a collection of points (gPoint)// vdPolyface cone = item as vdPolyface; msg = "vdPOLYFACE VertexList: " + cone.VertexList.ToString() + "\r\n"; foreach (gPoint item3 in cone.VertexList) { msg += item3.ToString() + "\r\n"; } System.Diagnostics.Debug.WriteLine(msg); } if (item is vdInsert) {//vdInsert's geometry is defined by the InsertionPoint, the Rotation, the scales and of course the block's objects)// vdInsert insert = item as vdInsert; msg = "vdINSERT Block Name: " + insert.Block.Name.ToString() + " Insertion Point: " + insert.InsertionPoint.ToString() + " RotationAngle: " + insert.Rotation.ToString() + "\r\n" + "vdINSERT Xscale: " + insert.Xscale.ToString() + " Yscale: " + insert.Yscale.ToString() + " vdINSERT Zscale: " + insert.Zscale.ToString(); System.Diagnostics.Debug.WriteLine(msg); } if (item is vd3DFace) {//vd3DFace's geometry is defined by the VertexList which is a collection of points (gPoint)// vd3DFace face = item as vd3DFace; msg = "vd3DFACE VertexList: " + face.VertexList.ToString() + "\r\n"; foreach (gPoint item4 in face.VertexList) { msg += item4.ToString() + "\r\n"; } System.Diagnostics.Debug.WriteLine(msg); }//vdPolyhatch's geometry is defined by the geometry of every vdCurve which that is consisted// if (item is vdPolyhatch) { vdPolyhatch hatch = item as vdPolyhatch; msg = "vdHATCH PolyCurves: " + hatch.PolyCurves.ToString() + "\r\n"; foreach (vdCurves item2 in hatch.PolyCurves) { foreach (vdCurve item3 in item2) { msg += "PolyCurve: " + item3.ToString()+"\r\n"; } } System.Diagnostics.Debug.WriteLine(msg); } } System.Diagnostics.Debug.WriteLine("=====END===="); }
请注意,所有这些对象还具有一个定义这些对象中某些对象的平面的拉伸向量(如vdInsert,vdCircle,vdEllipse,vdArc,vdText / MText,vdPolyhatch)。
对于以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。
热门文章推荐:
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系咨询相关问题。
关注慧聚IT微信公众号 ☟☟☟,了解产品的最新动态及最新资讯。
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn
文章转载自: