DiscussionsIssue archiveOther usage issues

Archived discussion

Functionnalies on an imported shape

Other usage issuesThu, 09/21/2006 - 00:374 replies

Browse this forum
QuestionAuthor

Hi,
I already imported my shape using the import-export, sample. Now I want to add functionnalites on that shape. For instance explore the model and put different colors depending on a selected direction. I am sure somebody has done something similar.
Thank for sharing.

Discussion

4 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hi,

You have to use this code first to get all the dispayed objects in the viewer :

// On obtient la liste des objets affichés
AIS_ListOfInteractive ais_objects;
aContext->DisplayedObjects (ais_objects);

// On instancie un iterateur d'objets
AIS_ListIteratorOfListOfInteractive iobject;

// Pour chaque objet affiché
for (iobject.Initialize (ais_objects); iobject.More(); iobject.Next())
{
// You get the object and you can do what you want(e.g change color...)
Handle(AIS_InteractiveObject) ais_object = iobject.Value();

}

02Author

Thank you very much. I will try your code and will let you know the result.

03Author

Could you guys check this for me:

Handle_AIS_InteractiveContext GlobalContext;
{
Handle(AIS_Shape) myAISObj = Handle(AIS_Shape)::DownCast(myAISContext->Current());
TopoDS_Shape aShape = myAISObj->Shape();

TopTools_IndexedMapOfShape aFaces;
TopExp::MapShapes(aShape, TopAbs_FACE, aFaces);
Standard_Integer nbFaces = aFaces.Extent();

GlobalContext->EraseAll();

GlobalContext->Display((aFaces(1), Quantity_NOC_WHITE, Standard_False));

}

Goal was to display face 1 in certain color.
Here is my error:

error C2664: 'void __thiscall AIS_InteractiveContext::Display(const class Handle_AIS_InteractiveObject &,const unsigned int)' : cannot convert parameter 1 from 'unsi
gned int' to 'const class Handle_AIS_InteractiveObject &'
Reason: cannot convert from 'unsigned int' to 'const class Handle_AIS_InteractiveObject'
No constructor could take the source type, or constructor overload resolution was ambiguous
Error executing cl.exe.

Thank you

04Commenter-1

These are the two ways to call the function Diaplay. The first parameter must be an AIS_InteractiveObject or a derived class.

void Display (const Handle(AIS_InteractiveObject)& anIobj,const Standard_Boolean updateviewer=Standard_True)

void Display (const Handle(AIS_InteractiveObject)& anIobj,const Standard_Integer amode,const Standard_Integer aSelectionMode,const Standard_Boolean updateviewer=Standard_True,const Standard_Boolean allowdecomposition=Standard_True)