Diesel Prefix in command customation

When I customise a command or call a selfwritten routine I usually prefix the call with:
_select;$m=$(if,$(eq,$(getvar,cmdnames),),,\)_[command] (where [command] is replaced with the routine name or the function)
This way the routine (or command) is applied to the current selection (if anything selected) or the selection can be made after clicking the customized button.
This works in AutoCAD. Can this be made to work in Bricscad as well?

Comments

  • You can do this:
    ^c^c_select;$m=$(if,$(eq,$(getvar,cmdnames),),,\)_move;p;;
    But this default macro has the exact same result:
    ^c^c_move

  • Martijn_DB
    edited November 2018

    It isn't meant to do the same thing.

    The idea of the conditional select is to always use the "Previous Selection set" within the routine or command
    In the first part - depending on the selection state (wheater something is already selected or not) - the user will be asked to make a selection.
    Then command is used with _P as previous selection set.
    So the ^c^c will have to go for sure. as this cancels the active selection.

    Example:
    Say I'd like to array some items down with a default spacing but with an amount specified by the user.
    When nothing is selected yet: I have to specify -ARRAY;\;R;\1;-2;
    or -ARRAY;\\;R;\1;-2; when making a selection window.
    When I already have selected the items I'd like to array prior to clicking the macro button you would use: -ARRAY;_P;;R;\1;-2;

    By using the conditional select statement the macro handling becomes should become uniform.

  • Are you sure about your 'for sure' claim?
    Almost all macros in the default.cui start with ^c^c and yet work with an active selection. To my knowledge ^c cancels an active command, not an active selection set. It is used twice because two (maybe even more?) commands can be active at the same time (one called transparently).
    I have tested my suggestions before posting. Maybe you should test them as well.

  • Martijn_DB
    edited November 2018

    @Roy Klein Gebbinck said:
    Are you sure about your 'for sure' claim?
    ......

    You are right about the ^C^C part. Indeed in can be included. Thank you for pointing out. I guess I assumed ^c to be similar to the escape key.

    I discovered that the select command works different in macro's than straight from the commandline.
    Difference:
    When applying the command having already something selected:

    • from the commandline: it exits the command directly storing the previous selectionset correctly.
    • from a Toolpalette button: discards the current selection and starting the select command as if no selection was made.
      Thus NOT 'storing' the previous selection set.

    Tried to use select as transparent command, (using ' ), but unfortunately not the desired result.

    Any suggestions?
    Or how would anyone make a macro or routine pickfirst compatible?

  • Roy Klein Gebbinck
    edited November 2018

    Your problem is caused by a known toolpalette issue. Your macros probably work just fine when called from a toolbar button (which I have tested with).

    I have created a small Lisp-based fix for the toolpalette issue:
    https://forum.bricsys.com/discussion/33802/copybase-toolpalette-issue-concerning-pre-selected-entities

  • @Roy Klein Gebbinck said:
    Your problem is caused by a known toolpalette issue. Your macros probably work just fine when called from a toolbar button (which I have tested with).......

    Just to close the issue: Yes indeed my issue is solved by calling from the Toolbar.
    Thank you and sorry for the late response.

This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!