TSL | How to execute custom TSL commands from palette or ribbon*

JS: June 2017 Author
Some TSLs provide custom commands which can be accessed by the right mouse button when the instance is selected. You can create a custom command to call these functions.

Add a palette button or custom command to the ribbon (see https://hsbcad.uservoice.com/knowledgebase/articles/1122091-toolpallets )

  • Language independent
  • Language dependent

^C^C: terminates any other ACAD command which might be active

NEWCOMMAND: replace this by any command name you want to assign, but make sure you are not overwriting an existing hsbcad or Autocad command.
You could use one command name for multiple tsls if you do not want to call the command from command line, but just ensure to make a command repeatable, i.e. "MyLastTslCommand"

COMMANDSTRING: replace by custom command string, i.e. Flip Side

CUSTOMPROMPT: replace by a prompt which will be presented to the user, i.e. Select Metalpart(s)

^C^C(defun c: MyLastTslCommand () (Hsb_RecalcTslWithKey (_TM "|Flip SIde|") (_TM "|Select Metalpart(s)|"))) MYLASTTSLCOMMAND

The sample above could be defined language dependent to German as follows:
^C^C(defun c: MyLastTslCommand () (Hsb_RecalcTslWithKey "Seite wechseln" "Metallteil(e) wählen")) MYLASTTSLCOMMAND

If you want to create a command which will run in multiple languages you need to define the command with the _TM functions of the english expressions.
It is recommened to specify the command language independent, as the translation might be changed or updated in order to enhance localisations.
The Hsb_RecalcTslWithKey command works with any TSL which has the COMMANDSTRING implemented as key. This means that any TSL matching this would be executed while the behaviour is dependent to the individual script.
Example: 'Flip Side' could well be defined to align a certain part of a metalpart or it could be used to drill a beam from one side or the other.

Some custom commands require the selection of additional entities. Each instance in the selection set will prompt for the defined actions unless the author has envisaged a combined behaviour for multiple instances.

Feedback and Knowledge Base