LPMODELDOC pModelDoc=NULL;
LPSELECTIONMGR pSelectMgr=NULL;
double retval[3];
CString string;
long nSelCount=0;
TheApplication->GetSWApp()->get_IActiveDoc(&pModelDoc);//获得指向活动文档的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();
本文介绍了一种方法来获取当前活动文档中选中点的三维坐标,并将其显示出来。通过使用pModelDoc和pSelectMgr指针,可以实现对选择管理器的操作,包括获取选择的对象数量及具体坐标。
2053

被折叠的 条评论
为什么被折叠?



