文檔金喜正規買球>>VectorDraw Developer Framework使用教程>>VDF常見問題整理(十一):如何創建一個復制模型視圖中顯示的3D視圖的視口?
VDF常見問題整理(十一):如何創建一個復制模型視圖中顯示的3D視圖的視口?
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
我想在一個旋轉的3D圖像的布局中創建一個視口。我希望新的視口能夠準確顯示模型視圖中的內容,具有相同的旋轉,目標點,范圍等。您是否在其中一個示例應用程序或其他地方有一些代碼可以完成我正在尋找的內容?這是創建一個復制模型視圖中顯示的3D視圖的視口。
答:
您可以使用vdView對象,它可以將布局或模型的所有視圖屬性復制到另一個布局/視頻。
請參閱以下代碼:
private void button3_Click(object sender, EventArgs e) { vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument; vdLayout lay = new vdLayout(doc, "BBB"); doc.LayOuts.AddItem(lay); vdViewport vp = new vdViewport(); vp.SetUnRegisterDocument(doc); vp.setDocumentDefaults(); vp.Height = doc.Model.ViewSize / doc.Model.PixelSize; vp.Width = vdFramedControl1.BaseControl.Width; vp.Center = new gPoint(vp.Width/2.0, vp.Height / 2.0d); vdView viewTMP = new vdView(doc, "mYvIEW1"); viewTMP.SetFromLayout(doc.Model); vp.SetFromView(viewTMP);// viewTMP is not necessary to be // added to the document in such occasions // or by hard code, without using the vdView object like : //vp.World2ViewMatrix = new Matrix(doc.Model.World2ViewMatrix); //vp.ViewCenter = new gPoint(doc.Model.ViewCenter); //vp.ViewSize = doc.Model.ViewSize; //vp.RenderMode = doc.Model.RenderMode; // set also PerspectiveMod,LensAngle, FocalLength etc if you use them lay.Entities.AddItem(vp); if (vp.Height < vp.Width) lay.Printer.LandScape = true; lay.Printer.PrintExtents(); lay.Printer.PrintScaleToFit(); lay.Printer.Update(); lay.Update(); doc.ActiveLayOut = lay; doc.CommandAction.Zoom("E", 0, 0); } Send comments o
以上回答希望對您使用VectorDraw產品有幫助,如果您有其他的疑問或者建議可以在評論區留言,我們會及時處理。
相關資料推薦: