Local Contexts

Hi
I am trying to understand how local contexts work and I have a problem about them. When I create a shape, I don't want any open local context thats why I close all contexts first using CloseAllContexts(). And for selection mode, I open a local context. This way worked fine until I try to create shapes using selected shapes i.e. when I create a shape using the shape from SelectedShape(), I close the context and I get segmentation fault for next MoreSelected() call. Any advice?

Thanks
xaeroxx

Robert Hill's picture

Hi,
I'm not sure exactly what you're trying to do but this may help.

You can select shapes (only shapes not edges, verticies, etc.) without opening a local context. They are referred to as current. Try getting the current shape and using MoreCurrent() instead of MoreSelected().

xaeroxx's picture

Thanks, but I should select edges, vertices etc. so I think I should use local context

Paul Jimenez's picture

My guess is that closing the current local context invalidates the list of selected shapes, so a call to MoreSelected and such will surely try to access a list/elements that exist no more. If you want to get all selected shapes, do so before closing the context.