Scripts in DraftSight

Scripts can be used to automate certain tasks within DraftSight.  It today’s blog, I’ll show you an example of a simple script that creates Layers and assigns Colours to those layers.  So, what do you need to get started? Well actually, apart from a copy of DraftSight, all you need is a text editor.  I’ll be using Notepad ++, but you can use Notepad that comes with Windows.

So that’s out script.  I’ll go though it and explain just what each line does and the formation of each line.

Line 1 is the command, in this case it is the Layer command.

Line 2 starts with n ( for new layer) and then creates these layers building, int-walls, windows, doors, int-dims, ext-dims, floor, and finally, room-names.  The structure of this line is very important.  There is no space between the layer names, it goes LayerName,LayerName,LayerName and so on.

Lines 3 to 10 assign a colour to the different Layers. So, the Line 3 starts with c (c for colour) 8 (for the colour number) and building (the layer name). There is a space between each entry on these lines, it goes c 8 building

Line 11 closes out the script using the (command).

You can, if you wish, edit the script to assign LineStyles (LS), LineWeight (LW) and other settings to your layers.

You can Copy and Paste the text below into Notepad and edit to suit your needs.  Once happy with your script, save it with the file extension *.scr

layer
n building,int-walls,windows,doors,int-dims,ext-dims,floor,room-names
c 8 building
c 6 int-walls
c 3 windows
c 4 doors
c 5 room-names
c 2 int-dims
c 7 floor
c 1 ext-dims
(command)

To run the Script, just type LoadScript at the Command Window and select your Script file.  It’s as easy as that.

And that’s how to create a simple Script to automate Layer Creation in DraftSight.

IMPORTANT:

DraftSight 2019 for Windows® is offered in paid versions only.
Once you download and install DraftSight 2019 (free 30-day trial or purchased version), you will no longer be able to re-download or access any previous free version of DraftSight (2018 or earlier). All free versions of DraftSight (2018 or earlier) will cease to run after 12/31/2019.

Learn more about DraftSight 2019 here.

MJ Smyth
The first time I used CAD, it was on a DOS PC with an 8088 processor, 640K of memory and a Hercules Mono Graphics Card... That, well that was a long long time ago. I switched to DraftSight the day it was released and haven't looked back!
MJ Smyth

Latest posts by MJ Smyth (see all)