翻譯|使用教程|編輯:況魚杰|2019-12-26 09:48:01.903|閱讀 342 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學習。本文將會展示如何單擊到多邊形并選擇到自己想要的一面。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
如何單擊到多邊形并選擇自己想要的一面?
答:
下面的代碼使用Select3D,然后使用RenderSelect的各種方法來獲取內部實體以及所選面所需的MAtrix。
private void TestIt() { vdDocument doc = vd.BaseControl.ActiveDocument; gPoint userpt = null; StatusCode s = doc.ActionUtility.getUserPoint(out userpt); if (s == StatusCode.Success) { gPoint pointW = doc.User2WorldMatrix.Transform(userpt); gPoint tmppt = doc.World2PixelMatrix.Transform(pointW); Point screenpt = new Point((int)tmppt.x, (int)tmppt.y); doc.EntitySelectMode = VectorDraw.Render.PickEntityMode.EyeNearest; //Very important so it is selected the eye nearest face , your drawing had default DrawOrder which in many occasions will return you the bottom face VectorDraw.Render.RenderSelect.RenterSelectObjectArray selectedents = null; doc.ActiveLayOut.Select3d(false, doc.ActiveLayOut.Entities, screenpt, doc.GlobalRenderProperties.PickSize, false, out selectedents); if (selectedents != null && selectedents.Count > 0) { VectorDraw.Render.RenderSelect.RenterSelectObject pfacerender = selectedents[0]; //Get the polyface vdPolyface pface = pfacerender.mFigStackItem[0].mFigure as vdPolyface; if (pface != null) { //The UserID gives you the segment of the polyface that was selected int SegCount = pfacerender.UserId; gPoints pts = new gPoints(); if (SegCount >= 0) { int seg = 5 * SegCount; if (seg <= (pface.FaceList.Count - 5)) { pts.Add(new gPoint(pface.VertexList[System.Math.Abs(pface.FaceList[seg + 0]) - 1])); pts.Add(new gPoint(pface.VertexList[System.Math.Abs(pface.FaceList[seg + 1]) - 1])); pts.Add(new gPoint(pface.VertexList[System.Math.Abs(pface.FaceList[seg + 2]) - 1])); if (pface.FaceList[seg + 3] != pface.FaceList[seg + 0]) pts.Add(new gPoint(pface.VertexList[System.Math.Abs(pface.FaceList[seg + 3]) - 1])); int[] array_faces = { 1, 2, 3, 4, -1 }; Int32Array faces = new Int32Array(array_faces); var pf = new vdPolyface(doc, pts, faces); //Calculate the Matrix to transform the face to World Coordinate System because the face is inside a block and has a completelly different coordinate system Matrix matt = pfacerender.mFigStackItem[0].mMatrix * doc.ActiveLayOut.View2WorldMatrix; pf.Transformby(matt); pf.PenColor.SystemColor = Color.BlueViolet; doc.ActionLayout.Entities.Add(pf); doc.Redraw(true); } } } } } }
以上問答,如果您有任何的疑惑都可以在評論區留言,我們會及時回復。此系列的問答教程我們會持續更新,如果您感興趣,可以多多關注本教程。
熱門文章推薦:
=======================================================
如果您對想要購買正版授權VectorDraw Developer Framework(VDF),可以聯系咨詢相關問題。
關注慧聚IT微信公眾號 ???,了解產品的最新動態及最新資訊。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: