I started using SOLIDWORKS back in 1998. At that time, DraftSight was a free download from SOLIDWORKS that provided users with a free version of an AutoCAD-like software. The benefit was that you could open and edit legacy *.dwg files and stay in the DWG format. The downside — and the major complaint I heard from users was that DraftSight didn’t allow customization and didn’t support the use of LISP routines.
Well, that was the Boomer version of DraftSight. If you haven’t checked out DraftSight of late, well, it’s an entirely different ball game.
There are now multiple flavors of DraftSight at different price points. DraftSight can even be used as a cloud-based app inside of 3DEXPERIENCE. This means you can have all the collaboration tools available within 3DEXPERIENCE and still be in a DWG format. I could have used that a few months ago when I was working with an electrical engineer who had created his wiring schematic in – hold on to your mouse – Lucidchart. The only thing worse might have been using PowerPoint (which I have also seen).
If we had had access to DraftSight (and the team was using SOLIDWORKS) inside of 3DEXPERIENCE, I could have edited his schematic with the wire length information he needed from the mechanical side. Plus, I could have made notations next to electronic components which had issues – like the wrong contacts listed or a typo in the manufacturer part number information. Not only that, but we would also have been able to check in and out the file and keep track of versions.
The current flavors of DraftSight are Professional, Premium and Network. There is also a mechanical version of DraftSight that should be released shortly. The professional subscription is $300/year. The premium subscription is $599/year, and the Network version starts at $399/year and increases depending on how many users are accessing the network license. You can download a free 30-day trial of the flavor of your choice to check out. The trial versions have all the features and capabilities of the paid versions.
All the current DraftSight versions support LISP, menu and toolbar customization, as well as custom shortcuts. However, if you are a tool palette aficionado, then you are going to want to dig a little deeper into your pocket and purchase the Premium version. If you are moving over from an AutoCAD subscription, which runs around $2,000/year, you can opt for the Premium version and still have more than enough change left over to support your next request for a raise.
Let’s start with how you can change the user interface.
DraftSight has similar icons and interface to AutoCAD. It’s different enough that you know you aren’t using AutoCAD, but not so different that you feel completely lost. It’s kind of like when your favorite pizza joint shuts down. You find a new pizza place and in no time at all you realize that the first place wasn’t irreplaceable.
DraftSight has workspaces available. You can create and save your own workspace once you have tweaked the user interface to your liking.
DraftSight has a lot going on. If you right click on the Properties palette, you see all the different options and tools available. (I am working with the Premium version of DraftSight.)
If you select the Customize Interface option, the Customize- Interface dialog opens.
Let’s start by creating a workspace where we can save all our customization settings.
First, select the UI Profiles on the left navigation menu. You’ll see the default UI Names listed.
Click the green plus icon on the right to create a new workspace.
Rename the workspace, and provide a description if you like.
I enable Auto-save workspace when switching so any changes I have made to the workspace are retained next time I use that workspace.
I want my workspace to be available to me when I am working, so I drop down to the Quick Access Toolbar section and add my new workspace to the Quick Access Toolbar.
I close the customization dialog. I want to switch to my workspace before I make any more changes.
The UI is now a blank slate. This can be a little upsetting.
Now, right click on the Properties palette and select Customize Interface.
Go down to the Ribbon Tabs section under UI Profiles.
Highlight the custom workspace and select the Ribbon tab explorer.
The ribbon list appears. You can create your own ribbons, as well. Simply drag and drop the desired ribbons to your workspace. You can organize them however you prefer.
If you change your mind and decide you don’t want an item, just drag it back to the explorer panel and drop it there.
Expand the Menu Bar section and select Menu Explorer.
Drag and drop the desired menus to your work space. Put them in the desired order.
Expand the Toolbars. Open the Toolbars Explorer, and drag and drop the desired toolbars.
Close the dialog for now. We will come back to it later.
I had hoped that DraftSight would have a LISP editor similar to the VLIDE interface inside of AutoCAD, but this is not the case. If you want to create your own LISP routine for DraftSight, you need to use Notepad – old-school style. The downside of using Notepad is that it doesn’t have the editing and debugging tools AutoCAD’s VLIDE editor provides. There is a free tool available called Notepad++ that provides some formatting for LISP routines.
DraftSight also doesn’t have the equivalent of the APPLOAD command – where you can load individual LISP routines as needed and store them so they automatically load on start up. You can load individual routines using the LOADAPP command, or create macros for each LISP routine to run. Alternatively, you can add your favorite routines to the startup.lsp file that comes with DraftSight. The downside of doing that is that if you upgrade DraftSight, your changes may be lost.
None of these are insurmountable obstacles, but if you have gotten lazy with the bells and whistles AutoCAD provides for users, you have to take a deep breath and resolve to bootstrap it.
I am going to walk you through how to create a small LISP routine for DraftSight, create a custom command and add the custom command to a toolbar.
Let’s walk through some of the process.
Open Notepad or Notepad++.
Just type these three lines of code. This is similar to the old “Hello, World” program we all learned when we first started coding. It basically just brings up a small dialog box that says “this works” If you want your dialog box to say something else, feel free to type something else between the quotations.
The ;; on the first line indicates a comment. I like to add comments so I can keep track of what I am doing.
Defun means define function. This is basically the start of your LISP routine. Notice the parenthesis that starts and ends the function or routine. The joke has always been LISP is an acronym for “lost in stupid parentheses”. Each command uses it’s own set of parentheses and it’s easy to lose track if you have too few or too many.
The C: indicates you are defining a command.
The name of the command is talert. This is what you would type on the command line to run the command. The () that follow the command name can hold variables you want to keep track of, but most coders leave it empty because if they change a variable name, it can create an error.
The next line – (alert “this works”) basically brings up a small alert dialog that says “this works.”
Then you have the final parenthesis which says that is the end of your function or routine. You can see that Notepad++ is keeping track of the parentheses and showing which ones match up.
Make sure you save the file as talert.lsp not talert.txt or the routine won’t work.
Type LOADAPP inside of DraftSight. Locate your talert.lsp file and load it. Then type talert in the command window.
Congrats, you just wrote and ran a LISP routine — and you did it inside of DraftSight.
We could create a template with the layers we like to use. I want to write a short LISP routine that creates four layers – object, center, hidden and dimension. That way I can run the routine and quickly have all four layers available. Obviously, you can modify this routine to add more layers and change the desired properties.
When I am writing a LISP routine, I start by running through the commands and writing down the prompts. If you don’t see the command window, type COMMANDWINDOW to toggle it on.
Based on the command prompts, I wrote the following LISP routine using Notepad++.
You can download this LISP routine here.
I saved the file away from DraftSight. I don’t want any of my LISP routines to be blown away if I uninstall the software or upgrade it.
To load the LISP routine, type LOADAPP. Browse to the location where the file is saved to select it and click Open.
If the file has no errors, you will see a message in the command window that the file has successfully loaded.
Next, we want to associate this LISP routine with a new icon and add it to a toolbar.
Bring up the Customize dialog like you did before. Highlight Commands. On the right, select Add Command.
Rename the command Add Layers.
If you click in the Light column, you can scroll down until you find an icon you would like to use. I selected the Layer_Add icon.
For the command string, type ^C^C to cancel out of any active command. Then type the defined command to run the LISP routine.
To add the custom command to a toolbar, highlight Interface in the left panel and expand the Toolbars list. Locate the toolbar where you want to place the custom command.
In the right panel, locate the desired custom command. (Notice that you can use the Find: field to search for the command.) Then simply drag and drop the custom command onto the toolbar.
You can use the same method to add a custom tool to a ribbon or a menu list.
Make sure you add the modified toolbar to the custom work space so you see it.
Some caveats: In order for any LISP routine to work, it has to be loaded first. In order to run the LISP routine as a custom command, it can’t have any special characters, such as _, -, &, etc. in the command name or the file name. If you don’t want to have to remember to load the LISP routine before using your custom tool, just copy and paste your LISP routine into the startup.lsp file that comes with DraftSight. That way it will load with DraftSight and always be available to you.
I may have to dust off all the LISP routines I wrote in the 1990s and update them to use with DraftSight.
About the Author
Elise Moss has worked as a mechanical engineer for more than twenty years in Silicon Valley. She owns her own consulting firm, Moss Designs. She is a Certified SOLIDWORKS Professional (CSWP) and a Certified SOLIDWORKS Instructor. She taught SOLIDWORKS part-time as adjunct faculty at Laney College in Oakland, CA for eight years. She is a regular presenter at 3DEXPERIENCE World. She holds a BSME from San Jose State University. She started writing LISP back in the late 1980s. She is a regular contributor to engineering.com.