How can i select more than one entity? hlp plz

I want to select a surface and transform it to a face ,select a point and transform it to a vertex...etc
my probleme is that i can't manage more than one selected object so how can i do a multiple selection without unselecting the previous selected object?can i do this with OCC5?

akbari1358_31365's picture

Try this:
for(myAISContext->InitSelected(); myAISContext->MoreSelected();
TopoDS_Shape shape=myAISContext->SelectedShape();
//Do some with shape...

jooog's picture

I already find that but i still get no answer for what you call"//Do some with shape..."
I want to select two faces and get the intersection with BRepAlgoAPI_Cut , can you help me
Handle(AIS_InteractiveObject) obj = myAISContext->Current();
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (obj);
//TopoDS_Shape Courrent = aShape->Shape ();
//if(Courrent1.IsNull) Courrent1=aShape->Shape ();
//else if (Courrent2.IsNull)Courrent2=aShape->Shape ();
//TopoDS_Shape ShapeCut = BRepAlgoAPI_Cut(Courrent1,Courrent2);
//Handle (AIS_Shape) aSection = new AIS_Shape(ShapeCut);

Patrik Mueller's picture


have you tried "ShiftSelect" as Hugues wrote?



Hugues's picture

If your problem is to allow the user to select more than one shape, then you should do the following :
- when the user picks an object :
- get the (x,y) mouse's coordinates
- call AIS_InteractiveContext::MoveTo (x, y, view_object)
- call AIS_InteractiveContext::ShiftSelect ()

Afterwards you can browse the selected shapes as Akbari shown it.

jooog's picture

Thanks to All for alL,
Most included OCC samples support multiple-selection (Use Shift-MB1) click to select/unselect.
I had already found that and it's typically what you said so thanks...