BricsCAD Lisp – Migrating from OtherCAD
BricsCAD LISP versus OtherLISP
If you’ve read my previous posts (part 1 and part 2), you know that BricsCAD fully supports the LISP tools that you and your company have relied upon for years (perhaps decades). Now, as you move to BricsCAD, you are ready to migrate your environment and standards. What are some of the items to consider?
For the sake of this discussion, we are going to focus on LISP customization and not on menu and custom user interface (CUI) modifications. However, I would first recommend using the default BricsCAD interface for a week or so before you make any changes to the menus. For me, I found that I actually preferred the standard layout and command access of BricsCAD over the “other” environment. Once I discovered where all commands were located, I found that I wasn’t toggling between tool menu palates as often as I did in OtherCAD.
As a side note… you know you are truly “old school” when you prefer to type short-cut commands with your non-mouse hand, rather than picking through 2 or 3 levels of menus. The more I use BricsCAD, the less I seem to rely on those keyboard short-cuts. The streamlined user interface and the quad cursor actually make it easier to use menus than to type. Try it, you’ll love it.
Almost no differences
When you’re ready to start migrating, you’ll find that there are virtually no differences in BricsCAD LISP versus OtherLISP. Your code loads and runs, and the functionality is identical. The primary differences when “porting” your apps will be a few minor setup steps, command line structure, and possibly file locations. To start, let review the setup and launch of your existing programs in BricsCAD.
If you are auto-launching your programs using Acad.lsp or Acaddoc.lsp, you will simply need to rename and or combine those files into a single file named “on_start.lsp”. To enable this feature, simply toggle the option in Settings / Program options / System:
I prefer to always enable this option.
Enjoy the BricsCAD Settings Panel
I would also recommend that you prepare to spend a little time familiarizing yourself with the Options/Setting menu in BricsCAD. As you dive in, you will find a ton of settings and options you probably wish you had in your “other” CAD environment. Welcome to BricsCAD!
The next step in the settings dialog would be to add your support folders to the Files search path, which is found within Settings / Program Options / Files:
As a rule, I never hard code any paths unless absolutely necessary. The support paths I use will typically be added as in the manner above and/or located one level below the current project folder. Typically, I will use a “findfile” function to validate the file exists before proceeding with my commands, as in the method below:
(if (findfile “custom-code.lsp”) (load “custom-code”))
In fact, this is one of the methods I’ve used to demand-load my functions within the on_start.lsp file:
(defun c:my-function () ; this defines the command
(if (findfile “custom-code.lsp”) ; check if the file exists
(load “custom-code”) ; if True, launch
(alert “Custom-code not in Support Path!”) ; not True, so alert
) ; end If statement
) ; end function
The command defun (DEfine FUNction) is the same name as the function inside of your on_start.lsp file and that function redefines the calling function when it’s launched. This is another cool reason for using this method, as it demonstrates how dynamic LISP can be!
Take advantage of your move to BricsCAD…
When your engineering workflow is running, you usually build a long list of maintenance items that you keep putting off. Migrating to a new CAD environment offers an opportunity to make some of those updates and update your documentation standards. Almost every client that I’ve helped to migrate need to address old-style hard-coded paths, 8.3 syntax filenames, old layer naming conventions and other no-nos within their standards. As we move forward in this series, I will share some of the methods I use to store user settings and defaults external to your LISP code, so that they can be updated more easily. Until next time, happy coding!