Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

OpenSCAD/Notepad++ Language File (including useage guide)

by Justblair, published

OpenSCAD/Notepad++ Language File (including useage guide) by Justblair Jan 3, 2012


Use This Project

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag


Thing Statistics

34924Views 5225Downloads


This guide is for Windows Users.

I am growing to love OpenSCAD as a creative tool for 3D design but I do find that it's text editor lacks many of the basic features that I appreciate when writing code... Namely:

Syntax Highlighting
Collapsible Outline levels
Line Numbering
Automatic Tabbing
Search and Replace
Block Tabbing using the tab key.

I was pleased to discover however that you don't need to put up with the standard text editor. There is a feature that allows you to conveniently use the text editor of your choice with OpenSCAD. My editor of choice is Notepad++ a fast well featured open source text editor. You can download it from http://notepad-plus-plus.org/

Notepad++ supports many different programming languages but not unfortunately OpenSCAD. It does however have the facility that allows you to create your own language file which I have included here.

This is definitely a work in progress as I have had to make a few compromises due to the limitations of Notepad++'s language editor. I dare say other more experienced coders opinions will differ as to how best to syntax code the OpenSCAD language.

I am currently working on adding auto-complete functionality to notepad++ as we speak. I have included a working though not complete file called openscad_removethisbitandcopy.xml. Currently most if not all functions will auto-complete, what is going to take me longer is adding call-tips to all the functions which would be nice though is not critical.

** Edits ***
13/5/2012 Added extension type to openscad.xml so that Notepad++ will now automatically detect language when .scad files are opened. Thankyou CrazyJaw, saved me some time there.


Installing The Language File

I assume that you have already downloaded and installed both OpenSCAD and Notepad++

  1. Download the openscad.xml file.

  2. Open Notepad++

  3. In the view menu pick the User-Defined Dialogue... item

  4. In a moment the User-Defined dialogue box will appear. Select Import

  5. The Open dialogue box will appear, navigate to where you downloaded the openscad.xml file and open it.

  6. That should be the openscad language file installed. You cna check by looking under the Language menu in Notepad++. At the bottom should be Openscad.

Using Notepad++ With OpenSCAD

  1. Open OpenSCAD, Create a new file and save it.

  2. In the Design menu select Automatic Reload and Compile

  3. In the View menu select Hide editor

  4. Leaving OpenSCAD running, now find your newly created .scad file in Windows Explorer, right hand click on it and select Edit with Notepad++

  5. Arrange both OpenSCAD and Notepad++ on your screen/s so that both can be seen at once. If you are using Windows Vista or 7 you can drag the title bars of the applications to the left and right sides of the screens to do this easily.

  6. Edit your .scad file in Notepad++. Each time you save the file (CTRL+S) you will see that OpenSCAD will recompile the object. You will need to choose the Openscad language from the Languages menu. You will also need to either modify the color scheme for the language file or chose a dark theme for notepad itself.

Enjoy all the advanced text editing features of Notepad++ as well as syntax highlighting of your code!!!

Enabling Auto-Completion in Notepad++

  1. Download the file named openscad_removethisbitandcopy.xml and copy it into either c:\Program Files\Notepad++\plugins\APIs (Windows 32bit) or C:\Program Files (x86)\Notepad++\plugins\APIs (Windows 64bit) or something like that depending on your setup.

  2. Rename the .xml file to openscad.xml

  3. Restart notepad and try it out. Auto-Complete can be activated by clicking CTRL-Space at any time.

  4. If you want Auto-Complete to be even more automatic, you can turn it on so that it will detect the functions as you type them... Go to Settings and click Preferences.

  5. When the dialogue box appears, select the Backup/Auto-Completions tab. Under the Auto-Completion section choose your preferred options.

All Apps

Upgrade this Thing with Thingiverse Apps

No results.

Jan 6, 2017 - Modified Jan 6, 2017

Thanks very much for the language definition. I've been using it for a couple of days now.

To add support for listing OpenSCAD modules in the Notepad++ function list you can make the following changes to functionList.xml:

  1. In the <associationMap> block add:
    <association userDefinedLangName="openscad" id="scad_module"></association>
    n.b. If you used a different language name than "openscad" when you imported the language definition, use that name here instead.

  2. In the parsers block add:
    <parser id="scad_module" displayName="scad" commentExpr="((/*.?*)/|(//.?$))">
    <nameExpr expr="[A-Za-z][\w]
    <nameExpr expr="[A-Za-z]?[\w]

Sorry, I don't know why the code was missing.
I added the following to functionsList.xml i hope it stays this time :

I´m using your awesome Notepad++ configuration files for OpenSCAD. However those files do not allow for listing modules and functions in the "function list" window. It seems from the manual that I have to create a new parser in functionList.xml. I tried to create a new parser for this language from the existing ones without success. I’m not a fluent programmer. I only need to detect the words ‘module’ and ‘function’.

I added the following to functionsList.xml :

Maybe there are some errors in this code, I don’t know. Can you help? Thanks a lot. Kind regards.

Thanks! This is awesome. It is so much faster. I always love Notepad++ and am just learning OpenSCAD.

Wow with this using Openscad is so much easier! TKX!!!

I got notepad++ 6.6.8
i got openscad.xml
In notepad++ / language menu / define your language / Import
I get "Fail to import" after choosing openscad.xml
Windows 7 Pro, notepad++ NOT in a protected system area.
Thank you for your help!

You are awesome. This is sooooo much better than using the built-in Openscad text editor. Thanks!

This somewhat worked for me, but 'Save' is grayed out on Notepad++ now. Any ideas?

'Save' will be greyed out if there are no pending changes to be saved, try altering the file and see if it becomes enabled.

This is great. Has anyone done the same thing for any Mac code editor?

Actually the connection between Notepad++ and Openscad can be even more automatic than you describe. You need to add a "Run" shortcut to Notepad++ which automatically invokes Openscad. To do that requires:

1.Run->Run... add "C:\Program Files(x86)\OpenSCAD\openscad.exe" "$(FULL_CURRENT_PATH)"

(or whatever your path is) to the dialog box.

  1. Save...

  2. Name: openscad (actually anything you want to call it)

Assign a key short cut ( I use ALT-O) OK

Exit Notepad++; restart it and you should find openscad under the run menu.

You can now create a file and have Notepad++ automatically start Openscad using that file. If you have set Design-> "Automatic Reload and compile" and View->"Hide Editor" in Openscad you will regenerate the model every time you do a Save (Cntrl-S) in Notepad++

I love the automation here. A batch file can also run both Openscad and Notepad++. Use a text editor to create a .bat file (I called mine scadfile.bat) with the following contents: (modify it to reflect the locations of your installed programs)

start "" "D:\Programs\npp.5.8.7\unicode\notepad++.exe" %1
start "" "D:\Programs\openscad-2011.12.30\openscad.exe" %1

Then right-click on a .scad file and go to "Open With" -> "Choose default program". Browse to the batch file you just created then click OK. Now OpenScad and Notepad++ will both open whenever you double-click on your .scad file.

I see what you are doing there. But for some reason I am unable to follow your instructions. Everything seems ok, but when I click the menu item or shortcut nothing happens.

I had some trouble getting this just right. You can check the shortcut by going into Users\<yourname>\AppData\Roaming\Notepad++\shortcuts.xml and validating that the line with the shortcut is:

<command alt="yes" ctrl="no" key="79" name="openscad" shift="no">"C:\Program Files (x86)\OpenSCAD\openscad.exe" "$(FULL_CURRENT_PATH)"

If it is not exactly like this, then edit shortcuts.xml (not with Notepad++) and change the line to match.</yourname>

I cant get this bit to work either. I am in C:Users\<name> but see no \AppData. I am in Win7 64bit.</name>

The quotes should be ampersandquot

You rock, I hated the amount of TABing I had to do with the built in text editor. This is perfect!

This seems like a great thing and a huge time-saver! Only problem is, I can't seem to install it? I'm running Notepad++ 5.5.1 on a 64 bit Windows notebook. When I open the User Defined Dialog, I don't see any way to do an "Import". I tried to do an Import style themes from the Settings menu, but it didn't do anything.

Any suggestions? What have I done wrong?


I just downloaded Notepad++ v6.2.2 and apparently they moved where to do the import.   I found it under  Language>Define Your Language...>Import  to get it to show up, you must import it, then pick it from the drop down list at the top of the user defined window where it says user define language.  then click on Save As and type in OpenScad.. now there will be an OpenScad entry at the bottom of the language pulldown.   

By the way, I really like having my editor in a separate window, makes it so much nicer on dual monitors!!

Someone give this guy a medal.

Great work by the way, huge time saver.

To get notepad++ to open scad files with the right highlighting, all you have to do is add set the ext="scad" in the second line of the openscad.xml
lt;userlang name="openscad" ext="scad"

That will do it automatically for anyone who imports the xml new. If you've already imported it and dont want to do it agian, you can just go to View-
gt;User Defined Dialog... And in the pop up, select "openscad" from the "user language" dropdown, and set the "Ext:" input box to "scad"

Thanks for that CrazyJaw. I have updated the xml file with your suggested information. It's only a little change, but it does make the whole experiance so much slicker :)

I installed it but the new language did not appear. I quit notepad++ and started it again but now it crashes and will not start. :'(

I can't find any files modified today apart from the crash dump and I can't find anything in the registry. How do I get rid of it?

Happened to me as well. I just re-installed npp on top of the old install, and it works nicely. You might want to put the xml files in the npp directory as well if you didn't do that.

Thanks for the nice guide and language definition, Justblair. And the autoComplete is sweet as well.

Sorry to hear that Nophead. Which bit did you install? Both files or just the first...

The file that gets altered when you import the language file (first stage) is held in

lt;your user name

If you have a look at it you will see all the data there in xml format

I installed just the first.

I got it running by installing notepad++ again. It now has the openscad language option which seems to work except the text background is black but the screen where there is no next is white. I.e. white space is white!

I changed the global default background to black and it works now, thanks.

It doesn't automatically recognise scad files from the extension. I have to tell it each time I open one. Is that right?

Considering that there is this issue that I just had to change. You should probably set the background color to black in the xml file. Also the line highlighting color should be set to a darker grey, considering the black background and the white text.

Yep. I haven't explored how to get that bit working yet. If anyone can suggest how i will add it to the guide.

Awesome, thanks. The syntax highlighting and auto-completion are a huge improvement on the default editor.

Glad you like it. I don't think I could go back now, even after just a few days using the Notepad++ features I consider it indispensable.

Excellent. and great timing. I was just getting fed up with the OpenSCAD editor.


Glad you find it useful Ben. Any feedback about how well or badly the language files are for you will be welcome.

I have not had a chance to play too much with the auto-complete tonight, but I think that it speeds up my coding.

The other thing to remember using notepad++ is the CTRL+Enter keyboard combo which gives you a list of words you have used recently. Very handy for autofilling in variable names.

Everyone thinks openscad is missing block commenting/tabbing but it's not true:

Block comment: Ctrl+d (add shift to un-comment)

Block tab: Ctrl+u (add shift to un-tab)

These shortcuts can be found in the menu.

Thanks Polymaker.. I had been trying to use the tab key... I will amend the instructions accordingly