For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Different Selection Mode for Different Object

Kamil Sikorski's picture
Forums: 

Hi Everyone,

Here is my problem. I wish to have different selection modes for different objects in my local context. Or somehow be able to swap between different contexts depending on what action I am performing.

To be more specific, I have a model that I need to load, and then be able to add objects onto that model. In order to add an object I would like to be able to select a face on the model, find the intersection of the line formed by the eye and at point of the selected face, and add the object in that location.

Now, after I add the objects, I want to be able to perform operations on that object, or add new objects. To add a new one, I need to once again select a face, but to perform operations on the object I need to select the whole object (which is a TopoDS_Compound). Therefore, I need to be able to take advantage of 2 selection modes (TopAbs_SHAPE & TopAbs_FACE) either in the same context, or be able to swap between contexts.

I have tried the following, and different version of it.

OnInit()
{
…...…
myAISContext->OpenLocalContext();
myAISContext->SetDisplayMode(AIS_Shaded);
myAISContext->ActivateStandardMode(TopAbs_FACE);
myAISContext->ActivateStandardMode(TopAbs_SHAPE);
}

AddModel()
{
…...…
AISShape->SetSelectionMode(TopAbs_FACE);
myAISContext->Display(AISShape);
myAISContext->SetSelectionMode(AISShape, TopAbs_FACE);
myAISContext->Activate(AISShape, TopAbs_FACE);
myAISContext->Deactivate(AISShape, TopAbs_SHAPE);
}

AddObject
{
…...…
AISShape->SetSelectionMode(TopAbs_SHAPE);
myAISContext->Display(AISShape);
myAISContext->SetSelectionMode(AISShape, TopAbs_SHAPE);
myAISContext->Activate(AISShape, TopAbs_SHAPE);
myAISContext->Deactivate(AISShape, TopAbs_FACE);
}