马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
得到用鼠标点击物体时,鼠标所点的那个点的坐标(不是屏幕坐标)
LPMODELDOC2 pModelDoc = NULL;
LPSELECTIONMGR pSelectMgr = NULL;
double retval[3];
CString string;
long nSelCount = 0;
TheApplication->GetSWApp()->get_IActiveDoc2([$pModelDoc)]
if (!pModelDoc) return;
pModelDoc->get_ISelectionManager([$pSelectMgr)]
if (!pSelectMgr) {
pModelDoc->Release();
return;
}
pSelectMgr->GetSelectedObjectCount([$nSelCount)]
if (nSelCount != 0){
pSelectMgr->IGetSelectionPoint (1, retval);
}
string.Format(_T("Selected point (%.2f,%.2f,%.2f)"),retval[0], retval[1],retval[2]);
AfxMessageBox(string);
pModelDoc->Release();
pSelectMgr->Release();
return; |