Author Topic: Problem with getpoint  (Read 2424 times)

0 Members and 1 Guest are viewing this topic.

Lupo76

  • Bull Frog
  • Posts: 343
Problem with getpoint
« on: February 23, 2015, 07:54:01 AM »
With the following line:

(while (= p nil)(setq p (getpoint "\nPoints: ")))

If:
- I press return asks me again to insert a point (ok)
- If I type 50 and hit return, accept the value instead of issuing an error "50 is not a point !!"

Any idea?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Problem with getpoint
« Reply #1 on: February 23, 2015, 08:06:16 AM »
Typing a single numerical value at a getpoint prompt will return a point a distance equal to the given value along a line through the point given by the LASTPOINT system variable and the cursor:

Quote from: getpoint documentation
Note that getpoint will accept a single integer or real number as the pt argument, and use the AutoCAD direct distance entry mechanism to determine a point. This mechanism uses the value of the LASTPOINT system variable in the Command Reference as the starting point, the pt input as the distance, and the current cursor location as the direction from LASTPOINT. The result is a point that is the specified number of units away from LASTPOINT in the direction of the current cursor location.

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Problem with getpoint
« Reply #2 on: February 23, 2015, 08:07:33 AM »
Typing a single numerical value at a getpoint prompt will return a point a distance equal to the given value along a line through the point given by the lastpoint system variable and the cursor:

Quote from: getpoint documentation
Note that getpoint will accept a single integer or real number as the pt argument, and use the AutoCAD direct distance entry mechanism to determine a point. This mechanism uses the value of the LASTPOINT system variable in the Command Reference as the starting point, the pt input as the distance, and the current cursor location as the direction from LASTPOINT. The result is a point that is the specified number of units away from LASTPOINT in the direction of the current cursor location.

You beat me to it, I just had the same reply....

Lupo76

  • Bull Frog
  • Posts: 343
Re: Problem with getpoint
« Reply #3 on: February 23, 2015, 08:10:04 AM »
Typing a single numerical value at a getpoint prompt will return a point a distance equal to the given value along a line through the point given by the LASTPOINT system variable and the cursor:

That is correct ;-)
But how can I avoid it?
I wish that the user is forced to click a point on the screen.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Problem with getpoint
« Reply #4 on: February 23, 2015, 08:37:35 AM »
In BricsCAD this works:
Code: [Select]
(while (not (vl-consp p))
  (initget 129)
  (setq p (getpoint "\nPoint please: "))
)
If the user enters a distance getpoint returns it as a string.

Alternative: Use grread.

rob

  • Mosquito
  • Posts: 3
Re: Problem with getpoint
« Reply #5 on: August 03, 2015, 05:46:13 PM »
Wrong Help to getpoint ...
(getpoint [pt] [msg]) ... Note: getpoint will accept a single integer or real number as the pt argument ... and so on ... no ... not as argument but as user input!

Right Help to getpoint ...
(getpoint [pt] [msg]) ... Note: getpoint will NOT accept a single integer or real number as the pt argument ... and so on ... is right!
But: the input of the user may be a real or integer ... this is right ...

have fun ... if you are able to ... rob