Loading ...
Sorry, an error occurred while loading the content.
 

RE: [cc2-dev-l] How to get the selection point of an entity ?

Expand Messages
  • L. Lee Saunders
    I hate to say it, but the *best* route is to just assign a global variable. Lee From: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] On Behalf Of
    Message 1 of 8 , Aug 10, 2010

      I hate to say it, but the *best* route is to just assign a global variable.

       

      Lee

       

      From: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] On Behalf Of Jdr68
      Sent: Tuesday, August 10, 2010 12:28 PM
      To: cc2-dev-l@yahoogroups.com
      Subject: Re: [cc2-dev-l] How to get the selection point of an entity ?

       

       

      Thanks a lot, the _asm thing did the trick.

       

      I'll not discard the DLScan though but I need to practise a bit more with it.

       

      I did try to design a Callback function that returns an entity, but whom does it return to as the Callback is called by the DLScan ?

       

      Do I need to use Parm1 or Parm2 ?

       

      Thanks again,

      JdR

      ----- Original Message -----

      Sent: Tuesday, August 10, 2010 5:23 PM

      Subject: Re: [cc2-dev-l] How to get the selection point of an entity ?

       

       

      Try:

       

      GPOINT2 *pPickPt;

       

      __asm mov pPickPt, edi;

       

      You have to be a bit careful with __asm statements. I often have to turn off optimization for the these parts in the release build.

       

      You might be better off with asking for a point (RD_2DC) and then scan for the selected entity (if any).

      You will need the function SetEachPickView() or SetEachPickViewEx(&PickedPt);

      Do a DLScan and test interesting entities with if(EPick(pEntRec))

       

      Peter

       

       

      Från: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] För Joachim
      Skickat: den 9 augusti 2010 20:30
      Till: cc2-dev-l@yahoogroups.com
      Ämne: [cc2-dev-l] How to get the selection point of an entity ?

       

      Hi,

      I'm trying to create a command that breaks a line to insert some drawing and I need the coordinates of the selection point.

      I wrote a dynamic cursor that stores X and Y in global variables and it works fine except that it doesn't recognise midpoint etc modifiers.

      The RDATA.H says that with RD_Pick1 you get the entity at esi and the pk point at edi. I know that esi and edi are ASM registers but am at a loss at how to retrieve the info with C++.

      Thanks for any help...

      JdR

    • Peter Olsson
      You can change the return type of the callback or cast to DWORD. Both will work. I often do: pENTREC XPCALL PickScan(hDLIST hDList, pENTREC pEntRec, PARM
      Message 2 of 8 , Aug 11, 2010

        You can change the return type of the callback or cast to DWORD. Both will work.

         

        I often do:

         

        pENTREC XPCALL PickScan(hDLIST hDList, pENTREC pEntRec, PARM parm1, PARM parm2)

        {

            if(EPick(pEntRec))

                return pEntRec;

         

            return 0;

        }

         

        You need to cast the result of the DLScan:

         

        pEntRec=(pENTREC)DLScan(…

         

        You can also pass pointers to variables in parm1 and parm2 that are updated and return any non-zero value to terminate the scan.

         

        Peter

         

        Från: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] För Jdr68
        Skickat: den 10 augusti 2010 19:28
        Till: cc2-dev-l@yahoogroups.com
        Ämne: Re: [cc2-dev-l] How to get the selection point of an entity ?

         

         

        Thanks a lot, the _asm thing did the trick.

         

        I'll not discard the DLScan though but I need to practise a bit more with it.

         

        I did try to design a Callback function that returns an entity, but whom does it return to as the Callback is called by the DLScan ?

         

        Do I need to use Parm1 or Parm2 ?

         

        Thanks again,

        JdR

        ----- Original Message -----

        Sent: Tuesday, August 10, 2010 5:23 PM

        Subject: Re: [cc2-dev-l] How to get the selection point of an entity ?

         

         

        Try:

         

        GPOINT2 *pPickPt;

         

        __asm mov pPickPt, edi;

         

        You have to be a bit careful with __asm statements. I often have to turn off optimization for the these parts in the release build.

         

        You might be better off with asking for a point (RD_2DC) and then scan for the selected entity (if any).

        You will need the function SetEachPickView() or SetEachPickViewEx(&PickedPt);

        Do a DLScan and test interesting entities with if(EPick(pEntRec))

         

        Peter

         

         

        Från: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] För Joachim
        Skickat: den 9 augusti 2010 20:30
        Till: cc2-dev-l@yahoogroups.com
        Ämne: [cc2-dev-l] How to get the selection point of an entity ?

         

        Hi,

        I'm trying to create a command that breaks a line to insert some drawing and I need the coordinates of the selection point.

        I wrote a dynamic cursor that stores X and Y in global variables and it works fine except that it doesn't recognise midpoint etc modifiers.

        The RDATA.H says that with RD_Pick1 you get the entity at esi and the pk point at edi. I know that esi and edi are ASM registers but am at a loss at how to retrieve the info with C++.

        Thanks for any help...

        JdR

      • Peter Olsson
        As far as I know it only return the point used for the pick testing. The RD_Pick1 does not have snap or ortho, but I think modifiers are processed. It will be
        Message 3 of 8 , Aug 11, 2010

          As far as I know it only return the point used for the pick testing. The RD_Pick1 does not have snap or ortho, but I think modifiers are processed.

           

          It will be tricky to use the center modifier of a circle though as the point will not be on the edge. It will probably be better to include the logic in the command in that case. I.e. the user picks the circle and the command extracts the centerpoint.

           

          Peter

           

          Från: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] För L. Lee Saunders
          Skickat: den 10 augusti 2010 18:17
          Till: cc2-dev-l@yahoogroups.com
          Ämne: RE: [cc2-dev-l] How to get the selection point of an entity ?

           

           

          Peter, will that work with the point selection modifiers like – get centerpoint of circle or get middle of path?

           

          From: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] On Behalf Of Peter Olsson
          Sent: Tuesday, August 10, 2010 10:23 AM
          To: cc2-dev-l@yahoogroups.com
          Subject: Re: [cc2-dev-l] How to get the selection point of an entity ?

           

           

          Try:

           

          GPOINT2 *pPickPt;

           

          __asm mov pPickPt, edi;

           

          You have to be a bit careful with __asm statements. I often have to turn off optimization for the these parts in the release build.

           

          You might be better off with asking for a point (RD_2DC) and then scan for the selected entity (if any).

          You will need the function SetEachPickView() or SetEachPickViewEx(&PickedPt);

          Do a DLScan and test interesting entities with if(EPick(pEntRec))

           

          Peter

           

           

          Från: cc2-dev-l@yahoogroups.com [mailto:cc2-dev-l@yahoogroups.com] För Joachim
          Skickat: den 9 augusti 2010 20:30
          Till: cc2-dev-l@yahoogroups.com
          Ämne: [cc2-dev-l] How to get the selection point of an entity ?

           

           

          Hi,

          I'm trying to create a command that breaks a line to insert some drawing and I need the coordinates of the selection point.

          I wrote a dynamic cursor that stores X and Y in global variables and it works fine except that it doesn't recognise midpoint etc modifiers.

          The RDATA.H says that with RD_Pick1 you get the entity at esi and the pk point at edi. I know that esi and edi are ASM registers but am at a loss at how to retrieve the info with C++.

          Thanks for any help...

          JdR

        • Jdr68
          That s what I was trying to do. I m in your debt... Thanks again ! ... From: Peter Olsson To: cc2-dev-l@yahoogroups.com Sent: Wednesday, August 11, 2010 9:00
          Message 4 of 8 , Aug 11, 2010
            That's what I was trying to do. I'm in your debt...
            Thanks again !
             
            ----- Original Message -----
            Sent: Wednesday, August 11, 2010 9:00 AM
            Subject: Re: [cc2-dev-l] How to get the selection point of an entity ?

             

            You can change the return type of the callback or cast to DWORD. Both will work.

             

            I often do:

             

            pENTREC XPCALL PickScan(hDLIST hDList, pENTREC pEntRec, PARM parm1, PARM parm2)

            {

                if(EPick(pEntRec) )

                    return pEntRec;

             

                return 0;

            }

             

            You need to cast the result of the DLScan:

             

            pEntRec=(pENTREC) DLScan(…

             

            You can also pass pointers to variables in parm1 and parm2 that are updated and return any non-zero value to terminate the scan.

             

            Peter

             

            Från: cc2-dev-l@yahoogrou ps.com [mailto:cc2-dev-l@yahoogrou ps.com] För Jdr68
            Skickat: den 10 augusti 2010 19:28
            Till: cc2-dev-l@yahoogrou ps.com
            Ämne: Re: [cc2-dev-l] How to get the selection point of an entity ?

             

            Thanks a lot, the _asm thing did the trick.

             

            I'll not discard the DLScan though but I need to practise a bit more with it.

             

            I did try to design a Callback function that returns an entity, but whom does it return to as the Callback is called by the DLScan ?

             

            Do I need to use Parm1 or Parm2 ?

             

            Thanks again,

            JdR

            ----- Original Message -----

            Sent: Tuesday, August 10, 2010 5:23 PM

            Subject: Re: [cc2-dev-l] How to get the selection point of an entity ?

             

            Try:

             

            GPOINT2 *pPickPt;

             

            __asm mov pPickPt, edi;

             

            You have to be a bit careful with __asm statements. I often have to turn off optimization for the these parts in the release build.

             

            You might be better off with asking for a point (RD_2DC) and then scan for the selected entity (if any).

            You will need the function SetEachPickView( ) or SetEachPickViewEx(&PickedPt);

            Do a DLScan and test interesting entities with if(EPick(pEntRec) )

             

            Peter

             

             

            Från: cc2-dev-l@yahoogrou ps.com [mailto:cc2-dev-l@yahoogrou ps.com] För Joachim
            Skickat: den 9 augusti 2010 20:30
            Till: cc2-dev-l@yahoogrou ps.com
            Ämne: [cc2-dev-l] How to get the selection point of an entity ?

             

            Hi,

            I'm trying to create a command that breaks a line to insert some drawing and I need the coordinates of the selection point.

            I wrote a dynamic cursor that stores X and Y in global variables and it works fine except that it doesn't recognise midpoint etc modifiers.

            The RDATA.H says that with RD_Pick1 you get the entity at esi and the pk point at edi. I know that esi and edi are ASM registers but am at a loss at how to retrieve the info with C++.

            Thanks for any help...

            JdR

          Your message has been successfully submitted and would be delivered to recipients shortly.