LISP problem getpoint / osnap
Hi all
I stumbled over a problem in release 10.3.11, something that worked well in earlier releases.
In the code snippet the following should happen :
- you pick a starting point (p1)
- you pick an endpoint (p2)
- from each of the two points a small offset is calculated and a line drawn (p3-p4)
Now, when I have osnap on and pick, as an example, first an endpoint and then a midpoint,
the offset is ignored and the line is drawn from p1 to p2. Switch osnap off or don't snap to
anything, the offset is calculated an the line drawn correctly from p3 to p4.
Feature or creature ? If it's a feature, how does it work ?
Jörg
(defun c:vline ( / p1 p2 p3 p4 UEA UEAA UEE UEEA wi)
(initget 1)
(setq p1 (getpoint "\nAnfangspunkt der Verlegung : "))
(if (null UEA)
(setq UEA -5.0)
);if
(princ "\nAbstand zum 1. Stab <") (princ UEA) (princ "> : ")
(setq ueaa (getreal))
(if (null ueaa)
(setq UEA UEA)
(setq UEA ueaa)
);if
(setq p2 (getpoint p1 "\nEndpunkt der Verlegung : "))
(if (null UEE)
(setq UEE -5.0)
);if
(princ "\nAbstand zum letzten Stab <") (princ UEE) (princ "> : ")
(setq ueea (getreal))
(if (null ueea)
(setq UEE UEE)
(setq UEE ueea)
);if
(setq wi (angle p1 p2))
(setq p3 (polar p1 (+ wi PI) UEA))
(setq p4 (polar p2 (+ wi (* 2 PI)) UEE))
(command "._line" p3 p4 "")
);defun
Comments
-
Hello, Jörg,
probably, quite easy to solve :-)
Object Snap does correctly apply to both (getpoint) and similar input functions, and
also applies when transferring points via (command) ... this is as it indeed should work.
In earlier versions, Bricscad behaviour was probably not fully correct (and Acad compatible).Solution is easy :
1. disable OSNAP during (command) sequence (setvar "osmode" 0) ... during (getpoint), the
object snap is likely intended
2. or even more elegant - do not use (command) to draw a line, but (entmake) or (entmakex) :
(entmakex (list (cons 0 "LINE")(cons 10 p3)(cons 11 p4)))
this will also create the new line on current layer, with current color etc.
=> it is also faster, and does not fie comand reactors
I hope this clearifies and helps ?
Many greetings, Torsten0 -
Hello Torsten
Problem solved ! From now on I will use entmake, it works nicely, thank you very much.
Cheers
Jörg
0