RETURN POINT GETSEL

RETURN POINT GETSEL

Anonymous
Not applicable
1,515 Views
6 Replies
Message 1 of 7

RETURN POINT GETSEL

Anonymous
Not applicable

Good evening!!

I need to capture the point clicked by (ENTSEL) regardless of whether it captured any object or not ...

Can anyone help me how to do this?

Example:

(setq obj (entsel "\nSelect objects": )) ;; clicar em NULL -> System variable ERRNO=7

(if (null obj)
(progn
(initget 32) ;; Rubber Band
(setq obj (getcorner "POINT I NEED" "\nSpecify opposite corner: ")
obj (ssget "_w" "POINT I NEED" obj)
)
) ;; end progn
) ;;end if

;; end Example


Thank you!

Emanuel Almeida - Brazil

0 Likes
Accepted solutions (1)
1,516 Views
6 Replies
Replies (6)
Message 2 of 7

john.uhden
Mentor
Mentor

If you want the point regardless of whether you picked any entity, entsel will not do that.  Try using getpoint and then nentselp if picking an entity has any importance.  If you don't care about picking an entity, then just use getpoint and skip the nentselp.

John F. Uhden

0 Likes
Message 3 of 7

Anonymous
Not applicable

Dear Mr. John, thank you for responding!

I understand that I should use GETPOINT, followed by GETCORNER, including a LISP already done this way (see below):

 

 

 

(initget 2 "S")
(setq dxold (getdist (strcat "\nDigite o fator de ajuste da largura (você está trabalhando com medidas em " funi "), ou <S> para selecionar dois blocos já posicionados, ou <enter> para zero: ")))
(if (equal dxold "S")
(progn
(setq dxold nil)
(while (equal dxold nil)
(prompt "\nSelecione dois blocos já posicionados na formação desejada (em linha reta horizontal): ")
(setq fp1 (getpoint "\nSelect objects: "))
(if (and fp1 (listp fp1)) (progn (initget 32) (setq fp2 (getcorner fp1 "\nSpecify opposite corner: "))))
(if (and fp2 (listp fp2))
(progn
(setq dxold (ssget "_c" fp1 fp2 (list (cons 0 "insert"))))
(if (/= (sslength dxold) 2)
(progn
(alert "É necessário selecionar DOIS BLOCOS devidamente posicionados, na posição horizontal.")
(setq dxold nil))
(progn
(setq dxold1 (list (falignents "c" (ssname dxold 1)) (falignents "a" (ssname dxold 0))) dxold1 (abs (distance (car dxold1) (cadr dxold1)))
dxold2 (list (falignents "c" (ssname dxold 0)) (falignents "a" (ssname dxold 1))) dxold2 (abs (distance (car dxold2) (cadr dxold2))))
(cond ((> dxold2 dxold1) (setq dxold dxold1)) ((> dxold1 dxold2) (setq dxold dxold2)) (t (setq dxold dxold1)))
)))))))

 

 

However, my research is being done with the purely aesthetic intent:

When using GETPOINT, the mouse cursor turns an X, whereas when we use ENTSEL, the cursor is with the PICKBOX square, and I wanted it to use GETPOINT (or some other device) with X, stick with PICKBOX square, understand?

 

Thank you!

Emanuel - Brazil.

 

0 Likes
Message 4 of 7

john.uhden
Mentor
Mentor

You are reminding me of a very complicated program I wrote to label bearings and distances and arc info of lines, arcs, and polylines even if nested in an xref.  I also wanted an aesthetic appearance and had to resort to using grread for every cursor move and keyboard input including Esc.  To get the proper looking pickbox or osnap I had to include "glyph" and "unglyph" functions to grdraw the pickbox or near or endpoint, etc.  It's actually sort of a grread work of art.  By many contributors' standards here, it is verbose rather than compact, but it works extremely well.  Maybe you could convince me to share some of it with you.  Only trouble is that even I (who wrote it) have trouble following its procedures because every cursor movement and click and keystroke has to be interpreted relative to a previous grread.  But it was fun to conquer.

John F. Uhden

0 Likes
Message 5 of 7

Kent1Cooper
Consultant
Consultant

Maybe you can use

 

(ssget "_:S")

 

which uses the pickbox, but if you don't pick on  something, goes into window/crossing mode automatically.  Whether that will work depends on what follows, because the (ssget) will end  with the other corner of the window/crossing pick, whether or not that  finds anything.

Kent Cooper, AIA
Message 6 of 7

john.uhden
Mentor
Mentor

Wow, Kent.  Thanks for the enlightenment.  I have never used that selection method.

The reason why I labored through all the grreads was to glyph the near point and endpoints of things just by passing the cursor over them (using nentselp), so that the user could see what he was about to pick.  Plus it enabled a bundle of other input methods without any initgets or object snaps, but just prompts.  But I think I never figured out how to inperpret a menu pick via grread.

 

Thanks again!

John F. Uhden

0 Likes
Message 7 of 7

Anonymous
Not applicable
Accepted solution

Dear, thank you for the help!

I found it simpler than I imagined ...

I will try:

 

Example:

(setq obj (entsel "\nSelect objects": )) ;; clicar em NULL -> System variable ERRNO=7

(if (null obj)
(progn
(initget 32) ;; Rubber Band
(setq obj (getcorner (cadr (grread t)) "\nSpecify opposite corner: ")
obj (ssget "_w" (cadr (grread t)) obj)
)
) ;; end progn
) ;;end if

;; end Example

 

The solution, in this case, is then: (cadr (grread t))

 

I found it on the internet, searching Getting cursor coordinates without picking a point

 

I'll adjust the routine, then I'll say it worked.

Thank you one more time!
Emanuel Almeida - Brazil.

0 Likes