Rhino SDK滑鼠訊息

你好,想請教在Rhino裡面顯示曲面方向的功能(_Dir),按下滑屬左鍵可以切換normal方向。
我剛開始使用Rhino SDK及Visual Studio C++開發Rhino外掛,我也想寫出這樣的效果(用滑鼠鍵切換曲面normal方向),請問有沒有範例說明如何抓取滑鼠訊息?謝謝

@dale, Is there a sample code that monitors mouse events in Rhino C++ SDK? tielsc wants to know how to achieve something like the Dir command that allows you to click on a surface to change its normal direction. Thanks.

以下是我們的工程師的回覆,不曉得對您是否有幫助?

Rhino’s DIR command does not use any special mouse picking code. Just simply uses our CRhinoGetObject class (C++) to pick the desired objects.

Here is the source to a sample command that displays the normal direction of meshes.

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleMeshDir.cpp

Does this help?

謝謝您的回覆,不過我所要的是當執行_Dir顯示曲面normal方向,除了用『F』鍵可以切換normal白色箭頭之外,當滑鼠游標移到曲面上的時候,也可以按『滑鼠左鍵』切換normal白色箭頭。而我想要瞭解的是這個滑鼠切換normal要使用哪個函式,謝謝。

PS:我有附上影片切換normal_x264.mp4 (2.7 MB)

我們的工程師說他沒有以滑鼠左鍵改變曲面 Normal 的例子。

我想,其實 Dir 指令並不是在監視滑鼠事件,它是"要求"在曲面上取一點。


Example 2: CRhinoGetPoint

這個例子有解答你的問題嗎?

我們的工程師 Dale 這樣說:
All mouse picking performed by the Dir command is done using a CRhinoGetObject class. Once the object is picked, just reverse the normals using ON_Brep::Flip().

就是我說的那個例子加上 ON_Brep::Flip()

好的,我再試試看,謝謝。