public Form1() { InitializeComponent(); //注册鼠标事件 this.renderView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.OnRenderWindow_MouseClick); } private void OnRenderWindow_MouseClick(object sender, MouseEventArgs e) { //通过鼠标位置选择形状 PickHelper pickHelper = renderView.PickShape(e.X, e.Y); if (pickHelper != null) { //获取所选形状的点位置 Vector3 pt = pickHelper.GetPointOnShape(); //创建球 TopoShape shape = GlobalInstance.BrepTools.MakeSphere(pt, 2); //显示球 SceneNode sceneNode = renderView.ShowGeometry(shape, 100); //设置球的颜色 FaceStyle style = new FaceStyle(); style.SetColor(new ColorValue(1, 0, 0, 1)); sceneNode.SetFaceStyle(style); } }
Caesar卢尚宇
2020年11月24日