March 22, 2022 By Dennis Collin
I often get asked if AutoCAD can be customised or programmed to get a standard command to perform in a certain way. The answer is often yes provided you know what to do!
Recently a question was raised if a line could be offset in two directions at once rather than having to do one half at a time e.g. a pipe or a wall needs to be drawn from a centre line with a specified offset or thickness. This can be achieved in many ways, but typically AutoLisp can be used. Lisp has been around for many years and many useful routines can be accessed and added to users AutoCAD start-up suite of bespoke commands.
I have posted some useful resources here: https://www.cadlinecommunity.co.uk/hc/en-us/articles/360002856597-AutoCAD-Automating-tasks-in-AutoCAD-with-AutoLISP
A routine that performs this task can be easily found after only a few minutes of searching one of the free Lisp repositories.
Of course, some users might argue that AutoCAD’s multi-line feature can do this, however multi-lines are somewhat inflexible if a width needs to be changed, and ultimately the elements are usually exploded down to lines anyway. The standard offset command has improved in recent versions, but it still lacks an offset in both directions, found in other software, but this omission is addressed by this routine.
Use the Appload function to load DOF.lsp into your AutoCAD session. To make this a permanent addition to the bespoke set of tools, ensure the desired routines are added to AutoCAD’s start-up suite. The command can then be accessed by typing DOF, in the same way as AutoCAD’s standard commands.
To retain the centre line element remove the entry marked in red in Notepad or similar.