Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Carsten Arnholm

Pages: [1] 2
Announcements / AngelCAD V1.5-06 released (Christmas 2020)
« on: 2020-12-12, 18:35:31 »
A new and improved version of AngelCAD has been released in time for Christmas!
This time, support for Ubuntu 20.04 LTS has been added.

Binaries for Windows, Ubuntu 18.04 LTS and Ubuntu 20.04 LTS:

  • Added support for Ubuntu 20.04 lts, be sure to download the version matching you OS version
  • AngelCAD language improvements
    • Allow hull2d() and hull3d() to accept a single solid@
  • Improved DXF import (File-> import 2s DXF...). Now opens result in editor.
  • Fixed issue with mesh repair (File-> Repair mesh file(s)...) (Output format selection disabled until user enables)
  • Extended OpenSCAD .scad support (Note: requires OpenSCAD to be installed)
    • Now includes support for DXF: import(file="model.dxf")
    • Now includes support for text: text(text="Hello World", font=...)
      • font, size, separation can be selected
      • alignment="center" can be specified
      • csgfix: added preprocessor for csg-files for improved processing

In this post we will explain what it means to run OpenSCAD .scad scripts with AngelCAD and why it can be a good idea. Using this feature requires AngelCAD V1.5 or newer.

One criticism against OpenSCAD is that it can be very slow and requires a lot of memory to run its .scad scripts. Since the .scad scripts are widely used, it would be a good idea if there was a way to run them faster. That is where AngelCAD comes in. The reason why OpenSCAD is slow and memory hungry is because it is based on the CGAL library. AngelCAD on the other hand is using xcsg which is based on Carve, so it has the potential to be much faster.

How does running .scad scripts work in AngelCAD?

NOTE: OpenSCAD must be installed on the same computer as AngelCAD to use this feature, because OpenSCAD is used for parsing the .scad script into an easier to handle .csg file. This process is however very fast since it does not involve CGAL.

From a user point of view, running .scad scripts in AngelCAD is just as easy as in OpenSCAD, only faster. Drop an .scad script into the AngelCAD editor and press the build button, and the resulting STL or other 3d file format is produced in no time. Behind the scenes, several things will then happen:

First,  AngelCAD calls on OpenSCAD to convert the .scad script into a .scg file (fully automatic):

$ openscad myfile.scad --o myfile.csg

Second, the .csg file is automatically scanned by AngelCAD to see if it contains OpenSCAD import statements referring to STL or OFF files. If it does, these statements are replaced by suitable OpenSCAD polyhedron statements. If the import refers to an STL, AngelCADs polyfix is used to automatically compute the polyhedron. The result is a cleaned up .csg file that also OpenSCAD can read.

Third, the cleaned up .csg file is passed to AngelCADs xcsg application. Normally, xcsg requires the .xcsg file format, but version 1.5 has been enhanced to also accept OpenSCADs .csg files. The result is a 3d STL or other format file.

$ xcsg --stl myfile.csg

This may sound more complicated than running OpenSCAD, but in reality it is just as simple and faster from a user's point of view. All steps are fully automatic and it is much, much faster than running OpenSCAD itself, especially if the model is of some size. This is because the xcsg/carve boolean engine is quite lightweight, it uses native numerical representation and unlike OpenSCAD it is able to employ multi-threading, which means it can use more than one computer core at the same time.

The attached screenshots show AngelCAD running OpenSCAD's example12.scad. This example imports an STL file, so all the steps explained above are being carried out.

Mesh resolution
OpenSCAD has parameters like $fn and $fa to control mesh resolution, but these are not used by AngelCAD/xcsg. Instead, the resolution is controlled by the secant tolerance. This is also true for .scad scripts when run via AngelCAD. As can be seen from the first screenshot below, the command line argument sec_tol=0.01  (alternatively specified as the longer equivalent secant_tolerance=0.01) can be used to control the resulting mesh resolution. For this reason, running the same script through OpenSCAD may result in a slightly different result.

The support for OpenSCAD modelling features is relatively complete, but not 100%. The following is a list of .scad language features that are not supported
  • import(file='somefile.dxf'): DXF or SVG file import is not supported. Import of STL and OFF is supported. Edit: DXF support is s available in V1.5-06
  • text(): text command is not supported. Edit: text() support is available in V1.5-06
  • surface(file='surface.dat'): surface command is not supported
  • resize(newsize=[30,60,10]): resize command is not supported
  • polygon without holes is supported, but a polygon with internal holes is not

Announcements / AngelCAD V1.5-00 released
« on: 2020-11-15, 17:23:27 »
EDIT: Please use the latest version listed below this post!

A new version 1.5-00 has been released
Windows and Ubuntu pre-builds are available at

This new version contains several new features as listed on the release page and summarised below. Posts describing the various new features will be created in the
Using AngelCAD forum, where users can participate.

  • New AngelCAD script arguments allow for customization
  • DXF import via File->Import 2d DXF...
  • Mesh repair via File->Repair Mesh file(s)...
  • Edit/run OpenSCAD .scad scripts from AngelCAD editor
  • Capture and display stderr messages from external applications
  • Editor now detects external editing of script files
  • All open editor tabs are now remembered and re-opened in next session
  • "Save & Close all buth this" right-click on editor tab
  • Changed shortcut for Find/Replace from F3 to Ctrl+F
  • Post-build export option
  • Fixed several smaller issues

AngelCAD version 1.4-00 was released 28 July 2020, so this post is a belated announcement of that fact. The post is made so that users know about the latest publically available version.

Windows and Ubuntu binaries at

Changes in this version
  • fixed missing member functions in spline2d and spline3d. This makes it possible to use spline curves directly in script code.
  • angelcad-samples: fixed segfault error for polygon & polyhedron
  • added new pointcloud to allow reading points from external files. This makes it easier to use external data to make for example a convex hull from a point cloud
  • added dxfread application to read DXF files. This is a stand alone console application that can convert 2d DXF files into an AngelCAD function for use in e.g. linear extrude
  • Windows version now built with MSVC2019. Now using an up to date Windows compiler to Build AngelCAD

General Discussion / Planned new features in AngelCAD
« on: 2020-09-06, 22:41:56 »
Here is a quick summary of things coming to AngelCAD. This thread is for discussing already planned features as listed. If you want to propose new features, feel free to start a new thread with a suitable subject heading.

Import of DXF files
This is not a language feature, but instead an external application (dxfread) that can be used alone, or from a new File -> Import DXF .. menu item in the AngelCAD IDE. When used, it generates an AngelCAD *.as file containing a function returning a shape2d@ object that you can use with linear_extrude, rotate_extrude, sweep etc.  For example, if you have a file "nice_drawing.dxf" and import it, you get a file "" containing a function with signature

Code: [Select]
shape2d@ nice_drawing_dxf();
In your main AngelCAD script you include the file

Code: [Select]
#include ""
And then call the nice_drawing_dxf() as required.

Support for script arguments
This allows some of the script variables to be defined outside the script. The variables become available via the the "args" input argument of the main_shape() function, and the script can extract the values as shown below and in the attached screenshot. If the variable is not provided by the user, a default value is specified in the script

Code: [Select]
// AngelCAD code.
#include ""

shape@ main_shape(as_args@ args)
   double height = args.get_unsigned_double("height",def:1.0);
   return linear_extrude(DXF447_dxf(),height);

Optional "post-build" export of generated files to a predefined directory
Using this option, a disk folder can be defined as the export directory for generated files, regardless of where the AngelCAD source is executed. This is a convenient feature where for example your slicer program can pick up STL files.

Processing of OpenSCAD csg files in AngelCADs xcsg engine
If you have an OpenSCAD .scad file, for example  "myfile.scad", you can use OpenSCAD to generate "myfile.csg"

$ openscad --o myfile.csg myfile.scad

The above is a fast process, even for large models because no boolean operations are involved (CGAL is not involved). Given the generated .csg file, you will then be able to use it as input to AngelCADs xcsg engine and create e.g. an STL file ! :

$ xcsg --stl myfile.csg

This can be many times faster than doing it directly in OpenSCAD. Granted, there are some limitations, not all .csg commands will be supported. This includes import,  surface, text and resize and some other things. But many models do not use these features, and sometimes this can be a big time saver. There is also a possibility that using this feature from the AngelCAD IDE might become possible, no decision yet.

The website "Hacker News" showcased AngelCAD on saturday, causing a sudden inflow of visitors to the AngelCAD GitHub pages, more than 3100 unique visitors in one day to be precise. I had no part in the appearance on Hacker News, I was informed after the fact by one of the moderators.

Hacker News is simply a list of topics where your story "slide off" the end fairly quickly, but it is a rather active site with some interesting topics, both software and other things. Below is the AngelCAD thread discussion link

AngelCAD: Script-based 3D solid modeller

This forum is being monitored even if not much has happened lately.
You are welcome to start a new topic about AngelCAD, questions or suggestions, If you do you will get a reply!

Looking forward to seeing you!

Using AngelCAD / Radiator fix
« on: 2019-10-06, 20:24:44 »
AngelCAD was used to design a part in order to fix a broken radiator, and the result turned out well, the radiator can be used again! Image of printed part is attached.

More images as well as STL for this part can be found at

Source code for the part follows
The code illustrates 2d and 3d features of AngelCAD, plus using variables for parametric modeling.

// AngelCAD code:

shape@ main_shape()
   double dx  = 59.0;
   double dy  = 26.0;
   double dy1 = 6.0;
   double th  = 2.0;   // thickness
   double h1  = 13.0;  // height of circular part
   double r_hscrew = 2.3;     // radius of horizontal screw holes
   double r_vscrew = 2.0;     // radius of vertical screw holes
   double x_screw = 20.0;     // x-coordinate of screw holes
   double y_screw = dy - 8.5; // y-coordinate of vertical holes
   double z_screw = 7.0;      // z-coordinate of horizontal holes
   double r_power = 10.5/2;   // radius of power hole
   double y_power = dy - 8.5 - 5.0;
   double x_flange = 10.0;

   // bottom plate is intersection between curcle and rectangle
   shape2d@ rect = translate(-dx/2,0)*rectangle(dx,dy);
   circle@  circ = circle({-dx/2,dy1},{0,0},{+dx/2,dy1});
   // main part consiste of horizontal and vertical pieces
   solid@  horiz = linear_extrude(rect & circ,th);
   solid@  vert  = linear_extrude(rect & (circ - translate(0,th)*circ),h1);
   solid@ main_part = horiz + vert;
   // holes for the vertical screws
   solid@ v_screw = cylinder(r:r_vscrew,h:50,center:true);
   @main_part = main_part - translate(+x_screw,y_screw,0)*v_screw;
   @main_part = main_part - translate(-x_screw,y_screw,0)*v_screw;
   // holes for the horizontal screws
   solid@ h_screw = cylinder(r:r_hscrew,h:50,center:true);
   @main_part = main_part - translate(+x_screw,0,z_screw)*rotate_x(deg:90)*h_screw;
   @main_part = main_part - translate(-x_screw,0,z_screw)*rotate_x(deg:90)*h_screw;
   // slot for the power wire
   solid@ power1 = cylinder(r:r_power,h:50,center:true);
   solid@ power2 = translate(0,dy,0)*power1;
   @main_part = main_part - translate(0,y_power)*hull3d(power1,power2);
   // slots for the flanges in the radiator plastic
   solid@ flange = rotate_x(deg:45)*cuboid(dx:3.0,dy:18,dz:15,center:true);
   @main_part = main_part - translate(+x_flange,0,0)*flange;
   @main_part = main_part - translate(-x_flange,0,0)*flange;
   // add triangular flanges for increased stiffness
   solid@ triangle = translate(0,3,1)*rotate_y(deg:-90)*linear_extrude(polygon({0,0},{10,0},{0,10}),th);
   @main_part = main_part + translate(+x_flange+5,0,0)*triangle;
   @main_part = main_part + translate(-x_flange-3,0,0)*triangle;

   @main_part = main_part + translate(+x_flange+17,3,0)*triangle;
   @main_part = main_part + translate(-x_flange-15,3,0)*triangle;

   return main_part;

void main()
   shape@ obj = main_shape();

Announcements / AngelCAD V1.3-02 released
« on: 2019-08-18, 22:10:40 »
A new version v1.3-02 of AngelCAD is out, linux and windows binaries available at

The upgraded version provides the following new features
  • projection2d allows projection of solids down to xy-plane and become 2d shapes. There is a new sample in the samples repository:

  • The AngelScript interpreter has been upgraded to version 2.33.0

  • try/catch has been enabled in the script language

General Discussion / AngelCAD on other linux distros?
« on: 2019-08-11, 09:22:41 »
At present, AngelCAD has prebuilt-binaries for Windows and Ubuntu

If there is sufficient demand, we could add support for one or two more linux distros. I would ask users to reply in this thread and say which distro they would like to see prebuilt-binaries for, and it will then be considered. No guarantees, though.

Using AngelCAD / AngelCAD on Thingiverse
« on: 2019-07-20, 10:39:15 »
This thread shall contain pointers to use of AngelCAD found on Thingiverse (or other similar sites). The idea is to show practical use of the software.

Of course, you can always use a generic search for items tagged with AngelCAD

A concrete example is the remixed "Finger Flobber" I made with AngelCAD . In this case an original STL was converted to OFF format using AngelCADs "polyfix" utility, and then imported and modified. See the *.as source file for details.

Announcements / AngelCAD v1.3-01 released
« on: 2019-05-30, 16:14:15 »
A new version v1.3-01 of AngelCAD is out, linux and windows binaries available at

1. The new version allows translating an object using a vec3d vector as an alternative to providing the x,y,z values directly. This can be especially convenient when the vector is the result of some calculation.

   vec3d v(100,0,0);
   solid@ object= translate(v)*sphere(50);

2. convenient initializer list construction for pos2d/3d and vec2d/3d has been introduced. For example, to define an array of pos3d objects, one can now write

   array<pos3d@> p = {{0,0,0},{1,0,0},{1,2,0},{1,2,3}};

3. Improved user documentation at

4. A new console application polyfix is now bundled with AngelCAD. This application can be used for repairing some mesh files in STL or other formats, and it can be used for remeshing to allow 'bending' or 'morphing' in AngelCAD. polyfix will be discussed in a separate forum thread.

Announcements / User documentation update
« on: 2019-05-18, 13:13:24 »
The AngelCAD language extension has today been updated to be more complete, with descriptive text for all scripting types and member functions. Also new is that return types are now shown correctly with the AngelScript handle symbol @ . In addition, the documentation search feature has been enabled, see top right of any documentation page. For example, type 'poly' there and the alternatives polygon and polyhedron are listed for selection.

These improvements should make it a better reference when using AngelCAD.

The update is the result of a new system for generating documentation from the scripting types, making it much easier to maintain.

General Discussion / User libraries
« on: 2019-05-04, 10:43:24 »
AngelCAD contains a number of built-in features, but since it is based on a scripting language, i.e. AngelScript with AngelCAD language extension, any user can create reusable *.as files and store them under the AngelCAD libraries folder.

To detect where the AngelCAD libraries folder is on your computer, use the menu item File -> Show Libraries Folder, which will open the file browser in that location. To create a new library called "mylib", you create a subfolder "mylib" and put your *.as files there. Then, from any other AngelCAD *.as source file, you can refer to your library using an #include statement. If we assume you created a file, it can be referenced as follows

#include "mylib/"

As an example of an existing library, see . If you open the libraries folder, and from ther issue the command
$ git clone

You can then use the solid trimming feature via an #include from another source file

#include "aclib/"

Installation and troubleshooting / How to install AngelCAD
« on: 2019-05-04, 10:25:32 »
To install AngelCAD, please go to and follow the Downloads link to download the pre-built executable for your operating system (Windows and Linux Ubuntu supported).

For Windows run the setup program to install the software. For Linux, run the install script as shown in this YouTube Video.

Pages: [1] 2