您好,请问一下,我用围珊工具画了一个围珊之后,如何只显示围珊内部的点云?
【手工操作】:选Ribbon界面中的Attach页面下的PointCloud组是的Clip工具可实现对一个点云的切割(仅仅是显示上的,点云本身的数据没有改变)。
【编程】:请研究一下C++函数PointCloudClipProperties::SetClipBoundary
示例代码如下(为简单起见,不含任何错误检验):
void clipPointCloud() { EditElementHandle eeh(1267L, ACTIVEMODEL); // get a point cloud edit element handle IPointCloudEdit* pEdit = dynamic_cast<IPointCloudEdit*>(&eeh.GetHandler()); PointCloudPropertiesPtr propsP = pEdit->GetPointCloudProperties(eeh); PointCloudClipPropertiesPtr clipPropsP = PointCloudClipProperties::Create(); bvector<DPoint3d> polygon; double uorPerMeter = ISessionMgr::GetActiveDgnModelP()->GetModelInfo().GetUorPerMeter(); polygon.push_back(DPoint3d::From(99553 * uorPerMeter, 80212 * uorPerMeter, 0)); polygon.push_back(DPoint3d::From(99579 * uorPerMeter, 80212 * uorPerMeter, 0)); polygon.push_back(DPoint3d::From(99579 * uorPerMeter, 80248 * uorPerMeter, 0)); polygon.push_back(DPoint3d::From(99553 * uorPerMeter, 80248 * uorPerMeter, 0)); clipPropsP->ClearClipBoundary(); clipPropsP->SetClipBoundary(*propsP, polygon); pEdit->SetPointCloudClipProperties(eeh, *clipPropsP); eeh.ReplaceInModel(eeh.GetElementRef()); }
Answer Verified By: nian chen
符工,请问一下,上面代码中的99553,80212等数字都是多边形顶点的坐标?
是的。是我针对我的一个点云测量出来的坐标。以主单位表达的,所以又乘了uorPerMeter
明白了,谢谢符老师