Selection Loss

Michael Mayer
edited November 2017 in BricsCAD BIM

Is there any chance to not lose a tediously created Selection,
like when using "classifying as Wall" and you would like to go on manipulating or editing ?

Or even worse, losing the selection when you just want to fit your View
by things like "Zoom Extends"



  • You can use _Previous to select the previous selection.

  • Hmmh,
    I get a :
    Unable to recognize command “PREVIOUS”. Please try again.

    Ah, I see,
    when I start a Command without a Selection, the flying option menu
    will appear, where it is available.

    It will not really help if I don't want a command but just change its Layer
    or similar. So I would still prefer to not lose selections until I personally
    destroy them intendedly.

  • To highlight and grip the previous selection you can create a (toolbar or tool palette) button with this macro:
    ^c^c^p(progn (sssetfirst nil (ssget "_P")) (princ))^p

  • Thanks for your custom workaround.
    I wished this would auto start hidden after every command ;)

    As you mentioned highlighting
    and I have problems to select things,
    I use and understand very much temporarily pre highlighting to see
    what you will select and selection highlight to control what is selected.

    But what is the meaning of Bricscad highlight elements that are not selected ?

  • Not sure I understand. But maybe your last question is related to the SELECTIONMODES setting? If not: please provide a more detailed scenario.

  • Michael Mayer
    edited November 2017

    When I try to select entities I often get a highlight only.
    I mostly want complete Entities and have edges or faces selection deactivated.
    (As CTRL+Click to switch to entity mode does not work for me most of the times either)

    It often takes more than one attempt to select.
    (Highlight only is much easier to achieve)
    Best is to wait until Quad opened and calmed down a bit
    (Otherwise it will select a whole bunch of entities)
    hover over an edge (Makes it more likely than a Face)
    And press LMB for a longer time.

    So I was also asking what is that Highlight only Mode good for,
    can I do anything useful to objects that are in permanent highlight but not selected ?

    ^ Maybe just everything a OS X issue ?

  • The only way I know of (in the Windows version) to highlight an entity without it being selected is to hover over it with SelectionPreview turned on.

    Also: there's a built-in Select command, which does nothing but create a selection set, and it accepts P for Previous.

  • Thanks,

    Indeed, there is no highlight only without selection, even on Mac.
    It looked for me like this because of a mixture between
    sometime my cursor was indeed still hovering (pre highlight)
    and slowness or issues with screen redraw.

    In crowded drawings still,

    • selection is hard
    • if I don't wait until the Quad opened, it will select anything under cursor box
    • It can take up to 2 seconds until the highlight disappears when cursor away.
  • Michael Mayer
    edited November 2017

    Looked closer into it.
    If nothing is selected, selection works (most times) with a "fast" click.

    I have set selection to not "add".
    So if I have something selected and click another element,
    the first selection will be canceled and the new object selected.
    That is the situation where a "too fast" click will (more) often fail.
    While Marquee selection works more reliably but the whole action
    lags. (Maybe less than a second but it feels like 2 seconds)

  • I, too, work with PickAdd turned off. I don't know whether this is connected to that, but I also work with SelectionPreview and EnableAttraction turned off.

  • Michael Mayer
    edited November 2017

    still laggy, but it looks like it is working a lot better by a standard mouse
    opposed to my Wacom Pen input ....
    (Not sure)

    A clean Config may also help ...

  • You could also experiment with different settings for PickDrag, PickAuto, and PickBox. I use 1, 1, and 5.

  • @Michael Mayer said:
    I wish this would auto start hidden after every command.

    That can be done, with custom commands created in Lisp. I have custom versions of all the commands that I use more than once a week. All my editing commands end with the selection set still selected. All my drawing commands end with all the new entities selected. I never have to use the Previous or Last option or the Select command.

  • 1,1,4 here.
    Pick Auto on of course. Couldn't live without that.

    For me it looks strange.
    Often it works without any issue, 5 seconds later it lags or misses selection.
    Even in a blank file with just 2 cubes.

  • @Anthony Apostolaros said:

    That can be done, with custom commands created in Lisp. I have custom versions of all the commands that I use more than once a week. All my editing commands end with the selection set still selected. All my drawing commands end with all the new entities selected. I never have to use the Previous or Last option or the Select command.

    Hi Anthony,
    could you please elaborate on how to do that.

    I am thinking about creation tools like
    Rectangle, Box, Polysolid .... to stay active for repetive use
    Classify (BIM) to keep (or better redo) the previous selection

  • Anthony Apostolaros
    edited June 2018

    For a command that only creates one new entity, it's easy. You just append "Select Last," or its lisp equivalent, after the command. If you use toolbars or pull-down menus, I think it can be done with a script, but I don't know the syntax for that. I use only the keyboard to execute commands, so I can't use scripts. I have to create all my custom commands in lisp. The full lisp function to define a custom command consisting of Rectang + Select Last would be:
    (defun c:RR () (command "Rectang") (while (> (getvar "cmdactive") 0) (command pause)) (sssetfirst nil (ssget "L")) )

    But since I have over 200 of these custom commands that terminate with a selection set, I have simple subroutines to handle some of the code:
    ;;; --- subroutine to pause for user input to a command (defun WaitCom () (while (> (getvar "cmdactive") 0) (command pause)) ) ;;; --- subroutine to select the previous set, or the last entity created (defun SelP () (sssetfirst nil (ssget "P")) ) (defun SelL () (sssetfirst nil (ssget "L")) ) (defun c:SP () (sssetfirst nil (ssget "P")) ) (defun c:SL () (sssetfirst nil (ssget "L")) )
    Those two commands, SP and SL, are really just aliases for Select Previous and Select Last.

    So the Rectang + Select Last command, with subroutines, is:
    (defun c:RR () (command "Rectang") (WaitCom) (SelL) )

    For a command that doesn't create any new entities, you can just add Select Previous after the built-in command. For the Lisp version you usually have to feed the built-in command some of the input it expects, so that the built-in command doesn't cancel your preselection:
    (defun c:M () (setq ss1 (ssget)) (command "Move" ss1 "") (WaitCom) (SelP))

    With commands that may create more than one new entity, you can't just add Select Last. You have to use Lisp. You get the number of the last-created entity, then execute the built-in command, then select any entities with a number higher than that:
    (defun c:LL () (setq EntName1 (entlast)) ; save the name (a number, actually) of the newest entity (setq ss1 (ssget "P")) ; save the previous selection set, ss1, in case no new lines are drawn (command "LINE") (Waitcom) (setq ss2 (_ssafter EntName1)) ; ss2 = all the entities just created (if ss2 (sssetfirst nil ss2) (sssetfirst nil ss1)) ; if nothing was created, keep the previous selection set )

    Some of my custom commands have parameters added to the built-in command, such as this one that replicates VectorWorks' 90 degree rotation command:
    (defun c:Rot90 () (setq ss1 (ssget)) (setq p1 (trans (apply 'acet-geom-mid-point (vle-getboundingbox ss1)) 0 1) ) (command "Rotate" ss1 "" p1 90.0) (sssetfirst nil (ssget "P")) )
    I have it assigned to the F7 key, so I can repeat it two or 3 times to get other angles, or just spin something around while I'm deciding what to do with it.

    Other examples, to make the Break and Matchprop commands behave as in VectorWorks:
    (defun c:B() (sssetfirst nil nil) (setq ent1 (entsel "Select Object: ")) (setq bp1 (getpoint "Break point: ")) (setq bp2 bp1) (command "Break" ent1 "F" bp1 bp2) (SelL) ) ; ------------------ (defun c:II () (princ "Select objects to be cloned...") (setq ss1 (ssget)) (if ss1 (setq ent1 (entsel "Select Object to clone from..."))) (if ent1 (command "Matchprop" ent1 ss1 "")) (SelP) )

    I'd be happy to share any of my custom commands with you. But I do only 2D drawing in DWG files, so you'll want a lot of commands that I don't have. For 3D I use Sketchup, which doesn't automatically cancel the selection set.

  • Wow.
    Thank you very much for your detailed answer !
    That should be sticky on top of the forum.

    But ouch, so it was no joke about LISP.
    I hoped it could be a few letters and special characters behind my
    custom Tool Panels Tool's command options ...
    So even there there would be at least Scripts needed.

    I am no programmer but just a visual thinking Icon-clicking Mac user.
    Coding, Scripting, LISP, Macros is way too far from my horizon.
    (Not my preferred way to use an App with a GUI though)

  • Anthony Apostolaros
    edited June 2018

    Maybe Script isn't the right word. I think it is just a few letters and special characters. Here's an example of what I meant by a menu script. It's the script for the built-in Select All command in the Edit pull-down menu:

    So maybe what you want for Rectang would just be:
    or something like that. Experiment with it. I don't even know where to look for the rules about menu scripts.

    And maybe the menu script for a Move command that keeps the selection set after exiting would be:

    And, actually, the lisp code needed for this purpose is very simple. You could probably learn it in a few days. There are lots of online education sites and forums to help you with it.

  • Thanks Anthony,

    now I am happy again.
    Tried to edit my rectangle tool in my partial UI palette.
    Would change the Tool everywhere (?)
    Tried to edit the Tool Properties in "Tools Palette" Draw Tab.
    that kind of freezes Bricscad.

    Could be because I'm on Mac though.
    Tried V17 too but that also doesn't quite behave as written in Help.

    So not yet there and have to watch ALL Grabowski Videos first.

  • Anthony Apostolaros
    edited July 2018

    I did a little checking last night. It looks like what I was calling a script is actually called a "macro" or "command macro." A script is apparently something you keep in a separate file and execute using the Script command. Maybe a command macro could be used to execute the Script command and have it open a particular SCR file, but I really know nothing about that.

    It was very hard to find any good information about how to write command macros. I tried many variations of that custom rectangle command, and finally stumbled onto one that worked:
    I don't know why that permutation worked and the others that I tried didn't, but that's often my experience with Lisp programming as well. For a while I was thinking that it might not be possible to chain two or more different commands in a macro, but apparently it is.

    Also, I realized that if multiple commands are allowed within a macro, you should be able to do all the customizing you want with macros. It should be possible to create two custom commands, one that saves the number of the newest entity, and another that creates a selection set of all the entities newer than that, and selects and highlights it if it exists, or otherwise selects and highlights the previous selection set. Then you should be able to insert any drawing or editing command, with or without options applied to it, into a macro in between those two commands and you'd be able to work in VectorWorks mode.

  • Michael Mayer
    edited June 2018

    Thanks Anthony,

    (I would feel better if we renounce of terms like Script, Macro and lisp.
    Lets stay with "just a few letters and special characters")

    I also watched Ralph's Videos to get a bit familiar with scripts.
    As being very sensitive with UI/UX,
    I raised my brows over BLANK, RETURN and ";" all mean ENTER.

    OK, so it is a "Macro", I'll accept that.
    I was short before calling Support of what
    "just a few letters and special characters"
    I would exactly need to force Bricscad Tools into a normal non-ACAD
    I will try your and Steven-g's suggestions.

    I currently just have some problems with UI and command customizations
    in the Mac Version and already SR-ed it.

    Generally for me, One Time Tools and Selection Loss are 2 separate
    I need the resurrection,
    for all Object Creation Tools
    (like Rectangles, Cubes, Polysolids, .....)
    I need immortal Selection,
    for any Object Editing Tools
    (like Move or BIM Classify, .....)

    while keeping Selection loss,
    where keeping Selection doesn't make sense
    (like BIM Connect or such)

    An Example for 1. would be,
    draw over a site plan's existing buildings,
    800 times Rectangles or Cubes.

    An Example for 2. would be,
    Tediously select your Wall Geometry to assign a Composition
    and finally want to switch on Display Composition in Properties.

    (What you want to do because in Bricscad you need to always check
    Walls Side Direction)

  • Anthony Apostolaros
    edited June 2018

    Here are the two custom commands I suggested earlier:
    (defun c:BEFORE () (setq LastE (entlast))) ; ------------------------ (defun c:AFTER ( / NewSS) (setq NewSS (_ssafter LastE)) (if NewSS (sssetfirst nil NewSS) (sssetfirst nil (ssget "P"))) )
    You don't need to understand them in order to use them. You can just copy that text and paste it into an unformatted text file called on_doc_load.lsp in the Support folder of your Bricscad program folder. Then the two commands will always be available, and you can include them in command macros:
    I couldn't figure out how to get the line command to draw more than one line. Same with the copy command, plus that syntax only works if the things to be copied are pre-selected. But here's a primer on command macros, and you can probably find more by googling "autocad macro language" or something similar.

    If you do want to understand those lisp functions:
    Lisp, like everything associated with .dwg cad, uses a kind of reverse logic. Parentheses can be used to indicate the order in which things are done, so in many cases the first thing written is the last thing done. Instead of lather, rinse, repeat, we say (repeat (rinse (lather))). The thing inside the innermost parentheses is done first, then the thing just outside of that operates on the result of that, and so on.
    But you can also use conventional order: (turnonwater) (repeat (rinse (lather))) (turnoffwater) The more advanced lisp programmers seem to avoid conventional order as much as possible. They also seem to like a lot of empty space on the page:
    (repeat (rinse (lather ) ) )

    Explication of the BEFORE and AFTER functions:
    (defun c:BEFORE () ; everything after a semicolon is commentary, not program code, until the next line ; lisp consists of functions, and all lisp functions are enclosed in parentheses ; other functions can be included inside a function: (function2 (function1) ) ; the inner function is performed first, then the result of that is used by the one just outside it ; (defun) is the master lisp function that defines a new function ; everything after defun is part of the new function, until all parentheses are closed ; you put the name of the function after the word defun ; if you precede the name of the function with c: it becomes a custom command ; the first set of parentheses is for arguments and local variables ; those parentheses can be empty, or they can contain (arguments / variables) (setq LastE (entlast)) ; the (entlast) function gets the name -- which is actually a number -- of the newest entity ; then the (setq) function assigns that number to a variable called LastE ; I did not declare LastE, because I want it to be global, i.e available to other functions ) ; that closes the defun parentheses ; ------------------------ (defun c:AFTER ( / NewSS) ; declaring NewSS as a local variable makes it empty, or nil, when the function starts ; since it is local to this function, it cannot inherit its value from a previously executed function ; that could also be done with the (setq) function: (setq NewSS nil) (setq NewSS (_ssafter LastE)) ; the (_ssafter) function creates a selection set consisting of all entities newer than LastE ; then the (setq) function assigns that selection set to the local variable NewSS ; of course, NewSS will remain empty, or nil, if no new entities were created (if NewSS (sssetfirst nil NewSS) (sssetfirst nil (ssget "P"))) ; the (if) function tests whether NewSS contains a value ; if it does, then the (sssetfirst) function selects and highlights the set it contains ; if it does not, then the (sssetfirst) function selects and highlights the previous set ; the (ssget) function is similar to the Select or Selgrips command, and P = previous ; the (sssetfirst) function always has nil as its first argument, due to a legacy issue ) ; that closes the defun parentheses

  • You are too fast for me Anthony,
    I need more time ;)

    I couldn't figure out how to get the line command to draw more than one line.
    Same with the copy command,

    I think because the Line Tool is the only Creating Tool in Bricscad,
    that already does work in a Continuous Mode by itself.
    Same for the Copy Tool which is now automatically in Repeat Mode.
    (I'm fine with both - even if that is ACAD behaviour)

  • @Anthony Apostolaros said:
    It was very hard to find any good information about how to write command macros. I tried many variations of that custom rectangle command, and finally stumbled onto one that worked:

    Ouch, that crashes my Mac Version ......

  • Roy Klein Gebbinck
    edited June 2018

    How to repeat a command (some of this you no doubt already know):

    1. If no command is active you can use the RMB to repeat the last command.
    2. A Tool Palette hatch action can also be repeated with the RMB.
    3. Standard keyboard shortcuts to cancel the running command and then repeat it are Ctrl+J and Ctrl+M.
    4. The _Multiple command will turn a normal command into a continuous command.
    5. A menu macro prefixed with * will repeat itself. This works for Toolbars and Tool Palette command actions.
    6. To repeat the last Tool Palette hatch action or command action you can call the _ExecuteTool command. Creating a tool for this purpose and linking it to a keyboard shortcut can be handy.
  • Michael Mayer
    edited June 2018

    Hello Roy.

    1. If set this way, I normally have RMB in blank screen set to "activate Quad"
    2. That is funny,
      I tried to edit my custom Panels rectangle in Customize UI Dialog.
      I get the warning that it will change globally and accept.
      It will NOT work for Rectangle in Ribbon as well as in my partial CUI Panel,
      nor will my setting be saved as I noticed !

    But now, when I tried again to edit the Rectangle in the Strange "Tools Palette" Panel,
    I found my edited Tool Command Option (now with "*") there !
    And it works well !

  • Anthony Apostolaros
    edited June 2018

    You should be able to write macros for any commands you want to customize. If you just include the Before and After commands (shown above) before and after the main command and any options you give it, you'll always terminate with the appropriate selection set, as in VectorWorks. Or in some cases you can just add Selgrips L or Selgrips P after the main command.

    But it looks to me like macros are not really much easier than using lisp to create custom commands. And a custom command has some advantages over a command macro. All those repeat-last-command methods that Roy mentioned only apply to the last command in a command macro chain. So if you execute before;^C^Crectang;\\^C^Cafter; and then press the space bar, you'll just get a repeat of the After command. That will appear to do nothing, since it will only re-highlight the already-highlighted selection set. The Rot90 command described above really has to be able to be repeated easily.

    If you want to try the lisp route, the following will get you started. Copy and paste it into the aforementioned on_doc_load.lsp and try it out. If you want others, say so. Maybe I'll have them, or perhaps one of the better programmers will help you write them. Roy, for example, could write all of this code while brushing his teeth.

    ; SUBROUTINES: ; ------------------------- (defun Before () (setq LastE (entlast))) ; ------------------------- (defun After ( / NewSS) (setq NewSS (_ssafter LastE)) (if NewSS (sssetfirst nil NewSS) (sssetfirst nil (ssget "P"))) ) ; ------------------------- (defun WaitCom () (while (> (getvar "cmdactive") 0) (command pause)) ) ; ------------------------- ; ------------------------- ; CUSTOM COMMANDS: ; ------------------------- (defun c:vwRectang () (Before) (command "Rectang") (Waitcom) (After)) ; ------------------------- (defun c:vwLine () (Before) (command "Line") (Waitcom) (After)) ; ------------------------- (defun c:vwPline () (Before) (command "Pline") (Waitcom) (After)) ; ------------------------- (defun c:vwMove () (Before) (setq ss1 (ssget)) (command "Move" ss1 "") (Waitcom) (After)) ; ------------------------- (defun c:vwCopy () (Before) (setq ss1 (ssget)) (command "Copy" ss1 "") (Waitcom) (After)) ; ------------------------- (defun c:vwExtend () (Before) (setq ss1 (ssget)) (command "Extend" ss1 "") (Waitcom) (After)) ; ------------------------- (defun c:vwTrim () (Before) (setq ss1 (ssget)) (command "Trim" ss1 "" ) (Waitcom) (After)) ; ------------------------- (defun c:vwRotate () (Before) (setq ss1 (ssget)) (setq p1 (getpoint)) (command "Rotate" ss1 "" p1 "B" p1) (Waitcom) (After)) ; ------------------------- (defun c:vwBreak () (Before) (sssetfirst nil nil) (setq ent1 (entsel "Select Object: ")) (setq p1 (getpoint "Break point: ")) (command "Break" ent1 "F" p1 p1) (After) ) ; ------------------------- (defun c:vwRot90 () (Before) (setq ss1 (ssget)) (setq p1 (trans (apply 'acet-geom-mid-point (vle-getboundingbox ss1)) 0 1) ) (command "Rotate" ss1 "" p1 90.0) (After) ) ; ------------------------- (defun c:vwEyedropper ( / ss1) (Before) (princ "Select objects to be cloned...") (setq ss1 (ssget)) (if ss1 (setq ent1 (entsel "Select Object to clone from..."))) (if ent1 (command "Matchprop" ent1 ss1 "")) (After) )

  • @Anthony Apostolaros
    As a long time Autocad LT user, I extensively use Macro's and scripts and have been in awe of the power of lisp but have never been able to follow the logic of even simple examples, with your earlier "lather, rinse, repeat" description I can actually see light at the end of the tunnel. Thank you, that whole post is really well laid out and I can actually follow the logic of it.

  • It is very interesting !
    Not sure if I will get everything into my head though.
    Thanks also for the PDF link. That cover the basics really well.

  • Anthony Apostolaros
    edited June 2018

    If you think you may want to learn to use lisp, you can try it out by entering any lisp function on the command line. It will immediately show you the result of that function. For example, enter (+ 10 5) and lisp will answer with 15. Then enter (/ (+ 10 5) 3) (or copy it from here and paste it onto the command line) and lisp will say 5. Then enter (+ (/ (+ 10 5) 3) 9) and lisp will say 14.

    You can also do that calculation with 3 separate lines, using a variable to transfer the result to the next line:
    (setq Sum1 (+ 10 5)) (setq Sum1 (/ Sum1 3)) (+ Sum1 9)Each line will be evaluated and the result will be shown on the command line.
    A lisp function is evaluated as soon as its parentheses close. That's why the innermost function is executed first -- its parentheses are the first to close.

    Then try (ssget) to see what that does. And then try this combination:
    (setq ss1 (ssget))(sssetfirst nil ss1)
    Then hit Esc to cancel the selection set, and enter just (sssetfirst nil ss1)to see that lisp still remembers what ss1 is.
    And then try it this way, using parentheses so that a variable is not needed:
    (sssetfirst nil (ssget))
    Then draw a rectangle and use this to select and highlight it:
    (sssetfirst nil (ssget "L"))
    And then try this combination:
    (setq ss1 (ssget))(command "copy" ss1 "")
    Or try it without the variable:
    (command "copy" (ssget) "")

    Get a list of built-in lisp functions, say at AfraLisp, and try some of them out to see what they do. Then try making up your own combinations, and when something works you can paste it into a macro, or use the (defun) function to save it as a new function or as a custom command.

    If you can't figure out which function is appropriate for something you're trying to do, or if a function doesn't seem to be working the way you think it should, ask about it here or at other online forums such as The Swamp. More experienced lispers are always willing to help.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!