VDF常见问题整理(九):如何在纵向或横向创建3D视图?

本系列教程整理了VectorDraw Developer Framework(VDF)最常见问题,教程整理的很齐全,非常适合新手学习,本节教程将会介绍如何在纵向或横向创建3D视图。

VectorDraw Developer Framework试用版下载


问:

    想要纵向或横向创建3D视图。它应该是由…… CommandAction.View3D(VFront)创建的视图,但该线的方向与x轴或Y轴不平行。应该怎么做/p>

答:

    您无法通过两个点或单个线来定义平面。为此,您需要3点或2行具有共同点(如他们的起点)。请参阅下面的代码:

  private void Set_View_by_3_Points()        {            //or by 2 lines that have a common point (their startpoint) and that define one plane            vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; doc.New();            vdLine linY = new vdLine(); // this line will define the Y axis            linY.SetUnRegisterDocument(doc); linY.setDocumentDefaults();            linY.StartPoint = new gPoint(1.1152,2.5053,-2.3408); //pt1            linY.EndPoint = new gPoint(0.6050,3.3411,-2.5438);  //pt2            linY.PenColor.FromSystemColor(Color.Green);            doc.Model.Entities.AddItem(linY);            vdLine linX = new vdLine();// this line will define the X axis            linX.SetUnRegisterDocument(doc); linX.setDocumentDefaults();            linX.StartPoint = new gPoint(1.1152,2.5053,-2.3408); //pt1 : same as linY.StartPoint            linX.EndPoint = new gPoint(1.8271,2.7833,-2.9858); //pt3            linX.PenColor.FromSystemColor(Color.Red);            doc.Model.Entities.AddItem(linX);            vdCircle cir = new vdCircle(); //is created just to see the plane where these two lines are            cir.SetUnRegisterDocument(doc); cir.setDocumentDefaults();            cir.Center = new gPoint(linX.StartPoint);            cir.Radius = 0.5;            cir.ExtrusionVector = new Vector(0.4826, 0.4735, 0.7368);            cir.PenColor.FromSystemColor(Color.Gray);            doc.Model.Entities.AddItem(cir);            doc.CommandAction.Zoom("E", 0, 0); // now UCS is PlanWorld, View is XY plane of PlanWorld            MessageBox.Show("3D lines created");            doc.World2ViewMatrix.SetFrom(new gPoint(linX.StartPoint), new Vector(linX.StartPoint, linX.EndPoint), new Vector(linY.StartPoint, linY.EndPoint));            // the call above sets the View to be the plane that LinX and LinY define            doc.CommandAction.Zoom("E", 0, 0);            MessageBox.Show("View changed to be the plane that these lines define");            doc.UCS("View"); // this is not a call that you need, it just sets the UCS to be the same as the View        }

Axolot Data厂商夏日特惠,Word 表系列组件大放“价”!

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2019年7月17日
下一篇 2019年7月17日

相关推荐

发表回复

登录后才能评论