Author Topic: getpoint <hopped-up>  (Read 12062 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: getpoint <hopped-up>
« Reply #30 on: October 31, 2005, 08:01:28 PM »
Code: [Select]
Command: (setq Pt2 (kb:getpoint nil nil (+ 1 8 ) nil nil))

Specify Point: 200
(3158.65 2069.37 0.0)

Command:
Command: (distance (getvar "lastpoint") pt2)
200.0



Command:
Command: (setq Pt3 (kb:getpoint nil nil (+ 1 8) nil '(0 0 0)))

Specify Point:  <Ortho on> 300
(300.0 0.0 0.0)


« Last Edit: October 31, 2005, 08:11:18 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: getpoint <hopped-up>
« Reply #31 on: October 31, 2005, 08:14:21 PM »
No, I'm not that smart. 8-)
I always considered that type of entry a missed key operation and tried to filter it out.
Here is my feeble attempt at that http://www.theswamp.org/forum/index.php?topic=5494.msg68365#msg68365
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: getpoint <hopped-up>
« Reply #32 on: October 31, 2005, 08:29:37 PM »
coincidence .. I was looking at that when you posted.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: getpoint <hopped-up>
« Reply #33 on: November 01, 2005, 01:46:09 AM »
Build 2.0 :
Code: [Select]
;;;--------------------------------------------------------------------------
;;;--------------------------------------------------------------------------
;| #lib.
kb:getpoint (Promptmsg Default InitBit KeyList BasePoint ...

Revised Library : kwb 20051031
20051101 kwb : ESC test added.
Build 2.0 :

(kb:getpoint "WorkPoint" '(200 100 0) (+ 1 8) '("BasePoint" "Apex") '(0 0 0))
|;

(defun kb:getpoint (Promptmsg                     ; The prompt string.
                    Default                       ; Value to return if response is <enter>
                    InitBit                       ; Initget bit
                    KeyList                       ; Initget keywords List of strings
                    BasePoint                     ; Base point < or nil >
                                                  ;
                    /              PromptMessage
                    InitString     KeyWordString
                    ReturnValue    ParameterList
                   )
  ;;------------------------------
  (or InitBit (setq InitBit 0))
  ;;------------------------------
  (if KeyList
    (setq InitString    (substr
                          (apply
                            'strcat
                            (mapcar '(lambda (item) (strcat " " item)) KeyList)
                          )
                          2
                        )
          KeyWordString (strcat " ["
                                (vl-string-translate " " "/" InitString)
                                "]"
                        )
    )
    (setq InitString ""
          KeyWordString ""
    )
  )
  ;;------------------------------
  (setq PromptMessage
         (strcat
           "\n"
           (cond (Promptmsg)
                 ("Specify Point")
           )
           KeyWordString
           (if Default
             (progn (setq InitBit (logand InitBit (~ 1)))
                    (if (= (type Default) 'str)
                      (strcat " <<" Default ">>")
                      ;; else, assume it is a point .. user beware
                      (strcat " <<" (kb:ptos Default nil nil) ">>")
                    )
             )
             ""
           )
           ": "
         )
  )
  ;;------------------------------
  (initget InitBit InitString)
  (if (vl-catch-all-error-p
        (setq
          ReturnValue (vl-catch-all-apply 'getpoint
                                          (if BasePoint
                                            (list PromptMessage BasePoint)
                                            (list PromptMessage)
                                          )
                      )
        )
      )                                           ; ESC was pressed.
    (setq ReturnValue nil
          Default nil
    )
  )
  (if ReturnValue
    ReturnValue
    Default
  )
)
;;;--------------------------------------------------------------------------
;;;--------------------------------------------------------------------------
« Last Edit: November 01, 2005, 05:19:15 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: getpoint <hopped-up>
« Reply #34 on: November 01, 2005, 08:05:14 AM »
Very nice Kerry. :-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

whdjr

  • Guest
Re: getpoint <hopped-up>
« Reply #35 on: November 01, 2005, 09:14:08 AM »
........    What happens if the user enters an invalid point like
8 <enter>

I'vecome back to this ...
8 <enter> could be considered valid because of
the AutoCAD direct distance entry mechanism.

ie : return a point 8 units in the direction of the cursor

You were trying to trick me Alan, yes ?

Kerry,

As you problably already know if you are going to allow for the 'Dynamic Distance Entry Method' then you are going to have to test for AutoCAD version info.  Which adds even more to your prog.

just my 2c.