Author Topic: Set default for getpoint  (Read 2567 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7531
Set default for getpoint
« on: November 17, 2004, 11:50:30 AM »
I am inserting our title blocks with lisp and was wondering how to make the insertion point default to 0,0 if the user hits enter. Does it have something to do with initgat?

Code: [Select]
 (initget 1)
  (setq pt (getpoint "\nPick Titleblock Location: "))
  (command ".-layer"
  "m"
  "m-sheet"
  ""
  ".-INSERT"
  "Aei8.5x11=Aei8.5x11.dwg"
  pt
  "1"
  "1"
  "0"
  )


Thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Set default for getpoint
« Reply #1 on: November 17, 2004, 12:08:27 PM »
Remove the (initget 1)
and use
(setq pt (getpoint "\nPick Titleblock Location: "))
(if (null pt) (setq pt '(0 0 0)))

Does not trap bad numeric entry from user.
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.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Set default for getpoint
« Reply #2 on: November 17, 2004, 12:08:56 PM »
Code: [Select]

(setq pt (getpoint "\nInsertion Point:<0,0,0> "))
;; if you hit <enter> at this prompt 'getpoint' returns 'nil'

(not (setq pt (getpoint "\nInsertion Point:<0,0,0> ")))
;; this returns 'T' if the user hits <enter>

;; so our test is to see of the user hit <enter> or picked a point
(if (not (setq pt (getpoint "\nInsertion Point:<0,0,0> ")))
  (prompt "\nUser hit <enter>")
  ;else
  (prompt "\nUser picked a point")
  )
TheSwamp.org  (serving the CAD community since 2003)

ronjonp

  • Needs a day job
  • Posts: 7531
Set default for getpoint
« Reply #3 on: November 17, 2004, 12:23:21 PM »
Thanks guys....I'll learn this lisp stuff someday :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

daron

  • Guest
Set default for getpoint
« Reply #4 on: November 17, 2004, 02:00:08 PM »
Do you need to use getpoint if you already know where you want your blocks placed?

(command ".-insert" "blockname" '(0.0 0.0) "1" """")

Something like that.

ronjonp

  • Needs a day job
  • Posts: 7531
Set default for getpoint
« Reply #5 on: November 17, 2004, 04:27:53 PM »
Quote
Do you need to use getpoint if you already know where you want your blocks placed?


I wanted to let the user be able to select a point......but most of the time the insertion will be 0,0.

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

taner

  • Guest
Re: Set default for getpoint
« Reply #6 on: September 26, 2008, 11:16:03 PM »
Quote
Do you need to use getpoint if you already know where you want your blocks placed?

I wanted to let the user be able to select a point......but most of the time the insertion will be 0,0.

Ron

http://paracadd.com/lisp.htm#external   

upoint.lsp