
Thu, 03/06/2025 - 17:11
When I tried to use AISnManigator to control the clip plane, I encountered some issues: I feel like I used the wrong transformation of the plane, and when I use the manipulator to control it, I don't feel like it met my expectations; When I try to drag the plane for translation, the manipulator disappears Here are some of my code and display effects:
```c++ m_man = new AIS_Manipulator;//init manipulator m_man->SetPart(0, AIS_ManipulatorMode::AIS_MM_Translation, Standard_False); m_man->SetPart(1, AIS_ManipulatorMode::AIS_MM_Rotation, Standard_True); m_man->SetPart(2, AIS_ManipulatorMode::AIS_MM_Scaling, Standard_False); m_man->EnableMode(AIS_ManipulatorMode::AIS_MM_Rotation);
```c++
// the clipplane
gp_Pln a_pln(gp_Pnt(0., 0., 0.), gp_Dir(0., 0., 1));
aClipPlane = new Graphic3d_ClipPlane(a_pln);
view->AddClipPlane(aClipPlane);
aClipPlane->SetOn(1);
Handle(Geom_Plane) aComponent = new Geom_Plane(aClipPlane->ToPlane());
Handle(AIS_Plane) a_plane = new AIS_Plane(aComponent);
context->Display(a_plane, 1);
m_man->Attach(a_plane);
context->Display(m_man, 1);
when mouse is press, the code is here:
```c++ context->MoveTo(event->pos().x(), event->pos().y(), view, Standard_True); if ((event->buttons() & Qt::LeftButton))//&& (QApplication::keyboardModifiers() == Qt::ShiftModifier)) {
context->SelectDetected();
if (m_man->HasActiveMode()) {
m_man->StartTransform(m_x, m_y, view);
}
}
when mouse is move ,the code is here:
```c++
if (m_man->HasActiveMode()) {
auto trs = m_man->Transform(x, y, view);
auto orgin_plane = aClipPlane->ToPlane();
orgin_plane.Transform(trs);
view->RemoveClipPlane(aClipPlane);
aClipPlane->SetEquation(orgin_plane);
view->AddClipPlane(aClipPlane);
context->ClearDetected();
view->Redraw();
}
but the result is failed.I would like to ask if there is any way to improve this program. Thank you