文档彩票走势图>>VectorDraw Developer Framework使用教程>>VDF常见问题整理(三十六):如何读取对象的几何属性(gPoints)?
VDF常见问题整理(三十六):如何读取对象的几何属性(gPoints)?
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微信公众号 ???,了解产品的最新动态及最新资讯。