Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Usage issues / Question about the neutral point and local context

Question about the neutral point and local context

Question about the neutral point and local context
Shu-Fang Fan 2012/10/18 19:44
I'm new to OpenCASCADE.
What I want to do is quite simple.

1. I read a IGES file and put the everything in one shape

IGESControl_Reader reader;     
Standard_Integer Status=reader.ReadFile(filepathname);
     if(Status!=IFSelect_RetDone)
          return Status;
     reader.TransferRoots();

     TopoDS_Shape aShape = reader.OneShape();
     aHSequenceShape->Append(aShape);

2. I display the objects in the viewer (in neutral point).
myAISContext->Display

3. In order to select an edge, I followed the method showed in the MFC example.
     myAISContext->CloseAllContexts();
     local_context_vector.clear();
     Standard_Integer local_context = myAISContext->OpenLocalContext(TRUE, TRUE, TRUE, TRUE);
     local_context_vector.push_back(local_context);
     myAISContext->ActivateStandardMode(TopAbs_EDGE);

4. I select an edge, and make a copy then display it.
     Handle(AIS_InteractiveContext) pAIS = GetDocument()->GetAISContext();
     if (pAIS->NbSelected()>0) //should be 1 if only one edge selected.
     {
          BRepBuilderAPI_Copy copy_api;
          for (pAIS->InitSelected(); pAIS->MoreSelected();pAIS->NextSelected())
          {
               copy_api.Perform(pAIS->SelectedShape());
               TopoDS_Shape copied_shape = copy_api.Shape();
Handle(AIS_Shape) ais_shape = new AIS_Shape(copy_shape);
myAISContext->Display(ais_shape);
          }
     }

5. After I close the Local context (for the edge selection filter), the new shape is gone.

I know the new copied edge is in the Local context. How can I keep it into the neutral point?

Any suggestion will be appreciated!
Hans 2012/10/22 23:49
Don't know if this is the right way, there might be a better one. But this works for me: CloseAllContexts before Display(ais_shape) and your new Shape will be displayed after your 5. Step.

:)
Shu-Fang Fan 2012/11/15 23:16
Thank you reply Hans.

I figured out the similiar way like what you suggested
 
 
Latest news
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!
  • Open CASCADE Technology 6.5.5 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map