what is the proper way of selecting a vertex from the view ?
Any ideas?
Thanks
How to select vertex in v6?
-
- Posts: 121
- Joined: Mon Apr 04, 2016 4:55 am
Re: How to select vertex in v6?
Hello jons882
Request KernelACDEvent to receive notifications like:
Use Advanced > Edit > Select > Vertices in the context menu (right click) and select a rectangle. This raises a KernelACDEvent event as part, which can be handled like:
To access the elements use something like:
This code is from MeshMods sample. MeshMods handles mesh object, but the code is only different by the type of elements in the list. The same code can be used for edges ( IBRepEdge_DG elements in the list) and faces IBRepFace_DG.
For mesh type of geometry the listed types are: IVertex, IEdge_KC(64) and ISimplex depending on e.param0 as EElemTypeKC
To determine the entity, where the elements belong, Query IEntity_DG from the list:
For completeness: If objects were specified for selection, the list contains ISection elements, from which IEntity_DG can be queried.
Request KernelACDEvent to receive notifications like:
Code: Select all
var iView = DgkControl.GetView() as IView_DG;
var iContext = iView as IKCContext;
iContext.SetBoolParam((int)E3DBoolParams.e3DBoolParamWantSelectEvent, true);
Code: Select all
private void OnKernelCADEvent(System.Object sender, _DKernCADnetEvents_KernelCADEventEvent e)
{
m_iList = null; // Type IList(64). Clear previous selection
if (e.eventType == (int)EDIEvent.eEventSelection)
{
// The user has selected something using direct user access (context menu)
if ((int)e.param0 == (int)EElemTypeKC.eElTypeVertex)
// Case vertices selected. Get the list
m_iList = e.param1 as IListT;
}
}
Code: Select all
IIteratorT iIter = m_iList.GetIterator();
POSNT pos;
POSNT n = iIter.GetCount();
if (n == 0)
return;
pos = iIter.GetHeadPosition();
while (pos != 0)
{
var p = m_iList.GetAt(pos);
IBRepVertex_DG iVtx = Marshal.GetObjectForIUnknown(p) as IBRepVertex_DG;
// Use iVtx
iIter.GetNext(ref pos);
}
For mesh type of geometry the listed types are: IVertex, IEdge_KC(64) and ISimplex depending on e.param0 as EElemTypeKC
To determine the entity, where the elements belong, Query IEntity_DG from the list:
Code: Select all
IEntity_DG iEntity = m_iList as IEntity_DG;
-
- Posts: 121
- Joined: Mon Apr 04, 2016 4:55 am
Re: How to select vertex in v6?
Edges of mesh is a special case. For selection to work the mesh has to be in upgraded state. Otherwise the list will be empty. See http://dynoinsight.com/Help/V6_0/Interf ... IsUpgraded
Re: How to select vertex in v6?
Thanks, Prashant
-
- Posts: 121
- Joined: Mon Apr 04, 2016 4:55 am
Re: How to select vertex in v6?
In Yesterdays 5012 update we have also added Selection sample which demoes all that
Cheers
Cheers