How to select vertex in v6?

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

How to select vertex in v6?

Postby jons882 » Tue Sep 24, 2019 6:56 am

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

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

Re: How to select vertex in v6?

Postby Prashant Kande » Wed Sep 25, 2019 6:57 am

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: 46
Joined: Mon Apr 04, 2016 4:55 am

Re: How to select vertex in v6?

Postby Prashant Kande » Fri Sep 27, 2019 3:36 am

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?

Postby jons882 » Mon Sep 30, 2019 4:42 am

Thanks, Prashant

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

Re: How to select vertex in v6?

Postby Prashant Kande » Wed Oct 02, 2019 6:55 am

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


Return to “General Issues”

Who is online

Users browsing this forum: No registered users and 2 guests