VectorDraw剪切多面體的方法

我們都知道,VectorDraw Developer Framework可以對3D視圖進行隨意裁切。下面我將用 vdCurve object 裁剪一個多面體,並用這個對象在多面體上裁切圓形或矩形等形狀。

從VectorDraw v6.024開始,添加了以下方法到vdPolyface object:

1
2
3
4
5
6
7
summary>Cuts this polyface using the passed vdCurve object.
param name="curve">A vdCurve object to be used in order to cut the polyface. You can use a circle , rect , ellipse , polyline and cut a polyface object.
param name="sideToKeep">A gPoint in WCS that represents the side of the polyface to keep.This point is relative to the vdCurve object.
param name="CreateCoverFaces">A boolean value representing if extra faces will be added in order to cover the cutted edges.
param name="CreatedFacesEdgesVisibility">A boolean value representing the edges visibility of the created cover faces.
returns>True if the command was succesfull.
public bool Cut(vdCurve curve , gPoint sideToKeep , bool CreateCoverFaces ,bool CreatedFacesEdgesVisibility)

 

同時還要添加一個方法到vdDocument object的CommandLine:

1
2
3
4
5
6
7
8
summary>Changes the passed polyface so it is cut with the passed curve. A point is also asked to determine which part of the polyface will be kept.
param name="polyface">The polyface object to cut OR null , "USER" so the user picks the polyface.
param name="curve">A vdCurve object OR null,"USER" so the user picks the curve.
param name="sideToKeep">A gPoint object or null,"USER" so the user picks a point on the screen. This point represents the side of the polyface that is going to be kept.
param name="CoverFaces">A boolean value OR null,"USER" so the user is prompted for a Yes/No answer. This boolean value represents if cover faces are going to be created where the polyface is going to be cutted.
returns>True if the command was succesfull.
remarks>This command is very usefull in order to slice a polyface with a curve and create various 3D objects. You can also use closed curves like circle,rects etc.. to create holes to a polyface.
public bool CmdCutPolyface(object polyface, object curve , object sideToKeep , object CoverFaces)

 

這個命令可以以這種形式進行調用:doc.CommandAction.CmdCutPolyface(null, null, null, true);

空參數會迫使庫提示用戶選擇一個多面體、曲線和點。這個命令對於3D對象的創建非常有用。

下面綠色的曲線是vdArcs,紅色的矩形框是由cmdBox創建的:

VectorDraw,cmdBox

在rendermode下經過四次剪切後的效果:

ItemsarcsResult,VectorDraw

下圖中綠色的部分是vdRect objects,紅色的部分是由cmdBox創建的多邊形盒子,同時在中間添加一個圓:

ItemsCone,cmdBox,VectorDraw

同樣,在rendermode下經過五次剪切後的效果如下:

ItemsConeResult,rendermode,VectorDraw

當然還可以作出更復雜的效果,如紅色的椎體和綠色的折線結合:

ItemsRectsResult,矩形框,VectorDraw,折線

ItemsRectsResult,矩形框,VectorDraw


* 點擊查看VectorDraw更多相關文檔

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章