翻譯|使用教程|編輯:況魚杰|2019-12-26 09:48:01.903|閱讀 342 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學(xué)習(xí)。本文將會(huì)展示如何單擊到多邊形并選擇到自己想要的一面。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
如何單擊到多邊形并選擇自己想要的一面?
答:
下面的代碼使用Select3D,然后使用RenderSelect的各種方法來獲取內(nèi)部實(shí)體以及所選面所需的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); } } } } } }
以上問答,如果您有任何的疑惑都可以在評(píng)論區(qū)留言,我們會(huì)及時(shí)回復(fù)。此系列的問答教程我們會(huì)持續(xù)更新,如果您感興趣,可以多多關(guān)注本教程。
熱門文章推薦:
=======================================================
如果您對(duì)想要購買正版授權(quán)VectorDraw Developer Framework(VDF),可以聯(lián)系咨詢相關(guān)問題。
關(guān)注慧聚IT微信公眾號(hào) ???,了解產(chǎn)品的最新動(dòng)態(tài)及最新資訊。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: