Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't call AIS_InteractiveContext::EntityOwners method, no SelectMgr_IndexedMapOfOwner type #78

Open
russelmann opened this issue Apr 20, 2021 · 3 comments

Comments

@russelmann
Copy link

russelmann commented Apr 20, 2021

I cannot find a way to call the method AIS_InteractiveContext::EntityOwners. It requires an argument of type SelectMgr_IndexedMapOfOwner which is not available through pyocct.

Any idea for a workaround to get the list of SelectMgr_EntityOwner from AIS_InteractiveContext or any over way to programmatically select subshapes of an AIS_Shape?

Edit:
An alternative could have been SelectMgr_Selection::Entities, however the return type NCollection_Vector<Handle< SelectMgr_SensitiveEntity > >& is not available through pyocct either.

@trelau
Copy link
Owner

trelau commented May 1, 2021

Do you happen to have an example script that reproduces the issue using AIS_InteractiveContext::EntityOwners? I think I can bind the missing type, but would like a reproducible example to make sure and then add to the test suite. Thanks!

@russelmann
Copy link
Author

russelmann commented May 2, 2021

I sketched the following code using my current anaconda installation of pyocct.

from OCCT.AIS import AIS_Shape
from OCCT.BRepPrimAPI import BRepPrimAPI_MakeBox
from OCCT.SelectMgr import SelectMgr_EntityOwner
from OCCT.TopAbs import TopAbs_EDGE
from OCCT.Visualization.QtViewer import ViewerQt

edge_mode = AIS_Shape.SelectionMode_(TopAbs_EDGE)

box = BRepPrimAPI_MakeBox(1, 1, 1).Shape()

viewer = ViewerQt()
ais_context = viewer._the_view.my_context
ais_shape = viewer.display_shape(box)
ais_context.Activate(ais_shape, edge_mode)

map_of_owner = SelectMgr_IndexedMapOfOwner()  # not binded
owners = ais_context.EntityOwners(map_of_owner, ais_shape, edge_mode)
entyty_owner: SelectMgr_EntityOwner = map_of_owner.FindKey(1)
entyty_owner.SetSelected(True)

viewer.start()

In my understanding this snippet should create a box and select one of its edges.

@russelmann
Copy link
Author

Is this example ok or having it without the viewer (or else) would be of any help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants