How to select vertex in v6?

Technical discussions
Post Reply
jons882
Posts: 4
Joined: Thu Sep 19, 2013 9:13 pm

How to select vertex in v6?

Post by jons882 »

what is the proper way of selecting a vertex from the view ?
Any ideas?
Thanks

Prashant Kande
Posts: 71
Joined: Mon Apr 04, 2016 4:55 am

Re: How to select vertex in v6?

Post by Prashant Kande »

Hello jons882

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);
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:

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;
            }
        }
To access the elements use something like:

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);
            }
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:

Code: Select all

IEntity_DG iEntity = m_iList  as IEntity_DG;
For completeness: If objects were specified for selection, the list contains ISection elements, from which IEntity_DG can be queried.

Prashant Kande
Posts: 71
Joined: Mon Apr 04, 2016 4:55 am

Re: How to select vertex in v6?

Post by Prashant Kande »

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

jons882
Posts: 4
Joined: Thu Sep 19, 2013 9:13 pm

Re: How to select vertex in v6?

Post by jons882 »

Thanks, Prashant

Prashant Kande
Posts: 71
Joined: Mon Apr 04, 2016 4:55 am

Re: How to select vertex in v6?

Post by Prashant Kande »

In Yesterdays 5012 update we have also added Selection sample which demoes all that
Cheers

Post Reply