Mon, 05/17/2004 - 15:07
Hi,
So far I have created an AIS_InteractiveContext object and opened a local context in it with face-oriented selection mode.
Here is how i set the selection mode :
void set_selection_mode (int sel_mode)
{
AIS_ListOfInteractive objects;
_ais_context->DisplayedObjects (objects);
AIS_ListIteratorOfListOfInteractive iobject (objects);
while (iobject.More ())
{
_ais_context->Display (iobject.Value (), _display_mode, sel_mode,true, true);
iobject.Next ();
}
}
It works fine for the first call. But later when I want to set an edge-oriented selection mode(thus sel_mode == 2) I can select faces and edges, but I don't want them both.
I tried "_ais_context->UnsetSelectionMode (iobject.Value ())" in the loop, but it does not work.
Does someone have an idea?
Mon, 05/17/2004 - 15:20
Hi Hugues,
could this help:
switch (m_CurSelectMode)
{
case SelectVertices:
{
m_pAISContext->OpenLocalContext();
m_pAISContext->ActivateStandardMode(TopAbs_VERTEX);
}
break;
case SelectEdges:
{
m_pAISContext->OpenLocalContext();
m_pAISContext->ActivateStandardMode(TopAbs_EDGE);
}
break;
case SelectFaces:
{
m_pAISContext->OpenLocalContext();
m_pAISContext->ActivateStandardMode(TopAbs_FACE);
}
??
HTH,
Patrik
Mon, 05/17/2004 - 17:11
Thanks Patrick for your reply.
I tried what you proposed, it doesn't work (I can't perform any selections). The problem is that I open a local context just after my AIS_InteractiveContext object is created. I load shapes into the local context, etc.
For example when the follwing is executed :
m_pAISContext->OpenLocalContext();
m_pAISContext->ActivateStandardMode(TopAbs_EDGE);
It seems that the interactive objects created in the local context are not available in the newly opened local context.
Maybe I should create all my interactive objects in the neutral point, and then open local contexts.
Sat, 01/15/2005 - 03:36
I have the same problem too, would someone explain about it?
Mon, 01/17/2005 - 12:45
I think opencascade is very worse, it's help file is worse too.
You can't find what you want to know anyway. Just like this problem , no one can answer. This product will died sooner or later.
Mon, 01/17/2005 - 13:36
Here is what I did, this works fine, but maybe there is a better way. Note that the interactive context involved should have an opened local context.
Pseudo-code :
//Create a context.
Handle_AIS_InteractiveContext ais_context = ...;
Integer previous_sel_mode = 0;
//Set the selection mode to `sel_mode'.
//0 -> whole shape
//1 -> vertex
//2 -> edge
//3 -> wire
//4 -> face
//etc.
void set_selection_mode (Integer sel_mode)
{
AIS_ListOfInteractive objects;
ais_context->DisplayedObjects (objects);
AIS_ListIteratorOfListOfInteractive iobject (objects);
while (iobject.More ())
{
ais_context->Deactivate (iobject.Value (), previous_sel_mode);
ais_context->Activate (iobject.Value (), sel_mode);
iobject.Next ();
}
previous_sel_mode = sel_mode;
}
Tue, 01/18/2005 - 20:11
Hi TengDX,
Please stay focused and constructive. The question is not whether it will die sooner or later (sadly to say ... everyone will die some day), the issue is how to find an answer. That’s the forum for – ask a question and await an answer, learn OCC, find a solution and post it, help others to learn in your turn. That’s how it should go.
Roman