Results 1 to 10 of 10

Thread: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

  1. #1
    Active Member
    Join Date
    2002-01
    Location
    Richmond, CA Lifer
    Posts
    72
    Login to Give a bone
    0

    Thumbs up Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    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:
    Code:
     ;|
     
     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)))
      )
    Last edited by BlackBox; 2015-08-19 at 05:40 PM. Reason: Please use [CODE] Tags, and stop using ALL CAPS

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    Unlike Microstation AutoCAD has multiple ways to handle that built in. Take a look at the legacyctrlpick system variable.

    Quote Originally Posted by AutoCAD 2016 Help Online

    LEGACYCTRLPICK (System Variable)
    Specifies the Ctrl key behavior for selection cycling and subobject selection.

    Type: Integer
    Saved in: Registry
    Initial value: 2



    0 Ctrl+click is used to select subobjects (faces, edges, and vertices) on 3D solids, surfaces, and meshes.

    1 Ctrl+click is used to cycle through overlapping objects. Disallows using Ctrl+click to select subobjects on 3D solids, surfaces, and meshes.

    2 Ctrl+click is used to select subobjects (faces, edges, and vertices) on 3D solids, surfaces, and meshes when SUBOBJSELECTIONMODE is set to 0.If SUBOBJSELECTIONMODE is set to 1, 2, 3,4, or 5, it is not necessary to hold down the Ctrl key to select subobjects. If you hold down the Ctrl key when SUBOBJSELECTIONMODE is set to 1, 2, 3,4, or 5, the subobject filter is turned off until the Ctrl key is released.
    AutoCAD has changed a lot with the last 21 releases over the last quarter century if you take the time to learn it you'll forget about how you used to have to do things in Microstation.
    Last edited by BlackBox; 2015-08-20 at 01:02 PM. Reason: Added tags for clarity of the help documentation; hope you don't mind

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    Revised code below though it adds extra steps to functionality already included in AutoCAD.
    Code:
    ;|
    
     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)
               (setq ss (ssadd))(ssadd e ss)
               (sssetfirst nil ss)
               (terpri)
               (list e pt)))
      )
    After loading the code with (load "TENSEL.lsp") enter (TENSEL) with the curser on the lines you wish to pick from.
    It can be run by adding it in the CUI Shortcut Menu "Context menu for default mode" and "Context menu for command mode".

    I recommend setting LEGACYCTRLPICK to 0. Then with a command active Shift+Spacebar while pickbox is over several lines will toggle highlight to each object below pickbox, then pick to select the highlighted one. Works about the same as you were used to and saves a step or two over using the lisp.

  4. #4
    Active Member
    Join Date
    2002-01
    Location
    Richmond, CA Lifer
    Posts
    72
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    I DON'T THINK IT'S PRODUCTIVE TO HEAR THAT CRITICISM FROM YOU ABOUT LEARNING AUTOCAD ... YOU DON'T KNOW ME AND SHOULDN'T JUDGE BECAUSE I ASKED FOR HELP. I UNDERSTAND SELECTIONMODE ETC.

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    Quote Originally Posted by gugg View Post
    I DON'T THINK IT'S PRODUCTIVE TO HEAR THAT CRITICISM FROM YOU ABOUT LEARNING AUTOCAD ... YOU DON'T KNOW ME AND SHOULDN'T JUDGE BECAUSE I ASKED FOR HELP. I UNDERSTAND SELECTIONMODE ETC.
    Didn't mean to offend, just trying to point out that's a big leap from versions 9 & 10 to 2016. AutoCAD is a completely different program now. Have you tried with LEGACYCTRLPICK set to 0? Don't know anything about Microstation's tentative button, but that seems to work the same as the lisp I tried to debug for you. Have you tried the modified code?

  6. #6
    Active Member
    Join Date
    2002-01
    Location
    Richmond, CA Lifer
    Posts
    72
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    THANKS FOR THE LEGACYCTRLPICK SUGGESTION. I'LL LOOK AT THE MODE OPTIONS AND SEE HOW IT HELPS.

    THE MAIN PURPOSE OF THE TENTATIVE BUTTON OPTION IN MICROSTATION IS IF I WANT TO PLACE AN ENTITY A CERTAIN "X & Y" DISTANCE FROM A N OBJECT I CAN USE THE TENTAIVE BUTTON TO PICK A POINT, ENTER THE "X & Y" (& Z) OFFSET DISTANCE THEN PLACE THE FIRST POINT OR OBJECT.

  7. #7
    Active Member
    Join Date
    2002-01
    Location
    Richmond, CA Lifer
    Posts
    72
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    I'VE BEEN AN AUTOCAD USER SINCE VERSION 2.0 AND AN OWNER SINCE RELEASE 14. (I ACTUALLY HAVE A CPM VERSION 1.0 THAT I FOOLED AROUND WITH IN THE EARLY 80'S.)

    SINCE 1984 I'VE BEEN AN AUTOCAD, MICROSTATION, CATIA, PDS, PDMS, PLANT SPACE, COMPUSERVE, SOLIDWORKS, VECTORWORKS, AUTO PLANT AND A DOZEN OTHERS EACH ONE REQUIRED WITH THE PARTICULAR JOB I HAD AT THE TIME. I'VE BEEN MOSTLY TIED AT THE HIP TO AUTOCAD (INCLUDING REVIT).

    I WILL TRY THE MODIFIED CODE AND DIG INTO LEGACYCTRLPICK MODES TO SEE IF I CAN EMULATE MY NEEDS. THANKS FOR THE HELP.

  8. #8
    Member
    Join Date
    2010-03
    Location
    Virginia Beach, Virginia
    Posts
    3
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    Please take a look at Object Snap Tracking to accomplish this in AutoCAD.

  9. #9
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    Quote Originally Posted by gugg View Post
    THANKS FOR THE LEGACYCTRLPICK SUGGESTION. I'LL LOOK AT THE MODE OPTIONS AND SEE HOW IT HELPS.

    THE MAIN PURPOSE OF THE TENTATIVE BUTTON OPTION IN MICROSTATION IS IF I WANT TO PLACE AN ENTITY A CERTAIN "X & Y" DISTANCE FROM A N OBJECT I CAN USE THE TENTAIVE BUTTON TO PICK A POINT, ENTER THE "X & Y" (& Z) OFFSET DISTANCE THEN PLACE THE FIRST POINT OR OBJECT.
    Please use sentence case, all caps is considered shouting and offensive in most forums. While not familiar with Microstation what you're talking about sounds similar to AutoCAD's from used To Specify a Point From a Temporary Reference Point. Have you tried the modified code? I could try and modify it some more, just not sure exactly what it was supposed to do.

  10. #10
    Active Member
    Join Date
    2002-01
    Location
    Richmond, CA Lifer
    Posts
    72
    Login to Give a bone
    0

    Default Re: Microstation Tentative Button Emulation Utilizing TENSEL.lsp Routine

    Object Snap Tracking IS IT! That is the closest to emulating the MicroStation TENTATIVE button function. Thanks.

Similar Threads

  1. autolisp routine, tentative button
    By gugg in forum AutoLISP
    Replies: 3
    Last Post: 2013-11-29, 08:02 PM
  2. Launching a VBA routine from a toolbar button
    By mpeterson79 in forum VBA/COM Interop
    Replies: 1
    Last Post: 2009-02-23, 10:11 PM
  3. Break / Trim button routine issue
    By TimTheriault in forum AutoCAD Customization
    Replies: 12
    Last Post: 2005-08-11, 07:52 PM
  4. Replies: 2
    Last Post: 2005-03-18, 09:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •