gugg
2015-08-19, 05:08 PM
Originally posted 29NOV2011 ... Trying again to generate positive comments and help ...
A few years ago I was using Autocad release 9 and 10, I was using a lisp routine named "TENSEL.lsp" for the tentative button tool which mimicked "Microstation" tentative button.
If you are not an experienced Microstation user you may not understand the criteria in which the tentative button operates. I'm hoping an AutoLISP guru with Microstaion experience can look at the "TENSEL.lsp" code below and determine what is needed to get the LISP routine working in a more current environment (I'm using Autocad 2016). This was in the day of 3 and 4 button mouse. You can see the code lines for mouse button menu.
This LISP routine was written in 1989 by the infamous Tony Tanzillo. I haven't been able to make any contact with him for help.
TENSEL.lsp:
;|
TENSEL.LSP Copyright 1989, 1990 Tony Tanzillo All rights reserved.
Emulates Intergraph uSTN's "tentative" selection button by letting the user
selectively cycle thru, highlight and select one of several entities that
cross thru, or lie entirely within the pickbox.
When you to need select a single object in a crowded area where you cannot
isolate the desired object alone within the pickbox, then place the pickbox
over it as you normally would, and then press the "tentative" button. Then,
one of the objects that crosses the pickbox will be highlighted. To advance
the highlight to the next elegible object, press either the PICK button or
the SPACE bar. When the desired object is highlighted, press RETURN to
select it, and it will be passed directly to AutoCAD along with the initial
selection point.
You can also use the tentative button for selecting all objects that are
requested by AutoCAD commands, and it will detect an ambiguous selection
and let you select one of the objects in the pickbox. If there is only
one object in the pickbox, then it will be returned with the selection
point, just as if you had used the PICK button to select it.
Note that using the tentative button is only valid in response to object
selection in AutoCAD commands. It cannot be used in response to a prompt
to select an object that is requested by another AutoLISP program.
Remember that the current location of the cursor when you first press the
tentative button will be the selection point that gets passed to AutoCAD
along with the object you select.
This has been tested with AutoCAD Release 9 and 10.
Program listing:
(pixel) Returns size of display pixel at current magnification
(defun pixel () (/ (getvar "viewsize") (cadr (getvar "screensize"))))
(ssbox <point> ) Returns "crossing" selection of all objects within
a PICKBOX-sized crossing box centered on <point>.
(defun ssbox (pt / c1 c2 delta)
(setq pt (trans pt 1 2))
(setq delta (* (getvar "pickbox") (pixel)))
(ssget "c" (trans (mapcar '(lambda (x) (+ x delta)) pt) 2 1)
(trans (mapcar '(lambda (x) (- x delta)) pt) 2 1)))
(tensel) - Implements a "tentative" selection button for AutoCAD R10.
This function MUST be invoked via a button on the pointing device, as it
uses the current pickbox location as the initial and resulting selection
point. Edit your ACAD.MNU file, or whatever .MNU file you want to use
TENSEL with, and insert a call to (TENSEL) in your button menu.
Below is an example .MNU ***buttons section with the tentative button
assigned to button number three on the pointing device.
***BUTTONS
^P(tensel)
^C^C
^B
|;
(defun tensel ( / ss pt e i l k RETURN)
(setq RETURN '( (2 13)
(6 0) ; <-- This is button ZERO on the pointing
) ; device, it is normally assigned to
) ; RETURN. If you have RETURN assiged
; to another button, then change the
; ZERO in the list (6 0) to the number
; of the button assigned to RETURN.
(cond
( (not (setq ss (ssbox (setq pt (cadr (grread t)))))) pt)
( (eq 1 (setq l (sslength ss)))
(list (ssname ss 0) pt))
(t (setq e (ssname ss 0) i 0)
; Once you've gotten the hang of it, you can remove this
; prompt expression.
; ------------------------------------------------------
(princ (strcat "\nFound " (itoa l) " elegible objects."
"\nUse SPACE/PICK button to highlight next "
"elegible object, RETURN to select."))
; ------------------------------------------------------
(redraw e 3)
(while (not (member (setq k (grread)) RETURN))
(cond ( (or (eq (car k) 3) (equal k '(2 32)))
(redraw e)
(redraw
(setq e
(ssname ss
(setq i (cond ( (= i (1- l)) 0)
(t (1+ i)))))) 3))))
(redraw e)
(terpri)
(list e pt)))
)
A few years ago I was using Autocad release 9 and 10, I was using a lisp routine named "TENSEL.lsp" for the tentative button tool which mimicked "Microstation" tentative button.
If you are not an experienced Microstation user you may not understand the criteria in which the tentative button operates. I'm hoping an AutoLISP guru with Microstaion experience can look at the "TENSEL.lsp" code below and determine what is needed to get the LISP routine working in a more current environment (I'm using Autocad 2016). This was in the day of 3 and 4 button mouse. You can see the code lines for mouse button menu.
This LISP routine was written in 1989 by the infamous Tony Tanzillo. I haven't been able to make any contact with him for help.
TENSEL.lsp:
;|
TENSEL.LSP Copyright 1989, 1990 Tony Tanzillo All rights reserved.
Emulates Intergraph uSTN's "tentative" selection button by letting the user
selectively cycle thru, highlight and select one of several entities that
cross thru, or lie entirely within the pickbox.
When you to need select a single object in a crowded area where you cannot
isolate the desired object alone within the pickbox, then place the pickbox
over it as you normally would, and then press the "tentative" button. Then,
one of the objects that crosses the pickbox will be highlighted. To advance
the highlight to the next elegible object, press either the PICK button or
the SPACE bar. When the desired object is highlighted, press RETURN to
select it, and it will be passed directly to AutoCAD along with the initial
selection point.
You can also use the tentative button for selecting all objects that are
requested by AutoCAD commands, and it will detect an ambiguous selection
and let you select one of the objects in the pickbox. If there is only
one object in the pickbox, then it will be returned with the selection
point, just as if you had used the PICK button to select it.
Note that using the tentative button is only valid in response to object
selection in AutoCAD commands. It cannot be used in response to a prompt
to select an object that is requested by another AutoLISP program.
Remember that the current location of the cursor when you first press the
tentative button will be the selection point that gets passed to AutoCAD
along with the object you select.
This has been tested with AutoCAD Release 9 and 10.
Program listing:
(pixel) Returns size of display pixel at current magnification
(defun pixel () (/ (getvar "viewsize") (cadr (getvar "screensize"))))
(ssbox <point> ) Returns "crossing" selection of all objects within
a PICKBOX-sized crossing box centered on <point>.
(defun ssbox (pt / c1 c2 delta)
(setq pt (trans pt 1 2))
(setq delta (* (getvar "pickbox") (pixel)))
(ssget "c" (trans (mapcar '(lambda (x) (+ x delta)) pt) 2 1)
(trans (mapcar '(lambda (x) (- x delta)) pt) 2 1)))
(tensel) - Implements a "tentative" selection button for AutoCAD R10.
This function MUST be invoked via a button on the pointing device, as it
uses the current pickbox location as the initial and resulting selection
point. Edit your ACAD.MNU file, or whatever .MNU file you want to use
TENSEL with, and insert a call to (TENSEL) in your button menu.
Below is an example .MNU ***buttons section with the tentative button
assigned to button number three on the pointing device.
***BUTTONS
^P(tensel)
^C^C
^B
|;
(defun tensel ( / ss pt e i l k RETURN)
(setq RETURN '( (2 13)
(6 0) ; <-- This is button ZERO on the pointing
) ; device, it is normally assigned to
) ; RETURN. If you have RETURN assiged
; to another button, then change the
; ZERO in the list (6 0) to the number
; of the button assigned to RETURN.
(cond
( (not (setq ss (ssbox (setq pt (cadr (grread t)))))) pt)
( (eq 1 (setq l (sslength ss)))
(list (ssname ss 0) pt))
(t (setq e (ssname ss 0) i 0)
; Once you've gotten the hang of it, you can remove this
; prompt expression.
; ------------------------------------------------------
(princ (strcat "\nFound " (itoa l) " elegible objects."
"\nUse SPACE/PICK button to highlight next "
"elegible object, RETURN to select."))
; ------------------------------------------------------
(redraw e 3)
(while (not (member (setq k (grread)) RETURN))
(cond ( (or (eq (car k) 3) (equal k '(2 32)))
(redraw e)
(redraw
(setq e
(ssname ss
(setq i (cond ( (= i (1- l)) 0)
(t (1+ i)))))) 3))))
(redraw e)
(terpri)
(list e pt)))
)