After completing implementation of the RapCAD parser I decided to give it a thorough test against as many files as possible. I created a script that scoured thingiverse and created a list of thingiverse scad asset urls.
I then ran the RapCAD parser against all of the downloaded scad scripts to see how it fared. The test includes 515 scad scripts, of these 380 seem to parse without problems, and 135 throw up syntax errors.
I have been investigating these errors. I found that 60 of the errors are accounted for by the fact that I am not supporting implicit includes (a deprecated feature in OpenSCAD). The remaining 75 are caused by the fact that I have created a more strict grammar for RapCAD. Hopefully this will mean my RapCAD parser is a more robust and less ambiguous. I will attempt to justify all of the syntax “improvements” and suggest changes that the OpenSCAD developers can consider.
Here is a list of those syntax errors:
Continue reading Fuzz Testing
I have been progressing slowly with my reprap build, spending a little time here and there modifying the electronics so that the wiring is neater. There are some details on the reprap wiki about how hack an ATX power supply to give you a universal power supply. This is my sightly neater solution which is specifically suited to reprap only.
With minimal filing the standard ATX power supply grommet hole can be opened out to fit a standard XLR socket. I used a female socket as opposed to the male socket mounted on the reprap. This is standard practice and ensures that the pins of the socket cannot be touched if the connector is removed. In general the live end is protected and the cold end is not.
After a few helpful comments I was pointed in the right direction for drilling a hole down the middle of my hobbed M4 insert. Unfortunately I didn’t have a drill vice, so I used my trusty Block’o’Wood and a fair amount of extra caution instead.
It really is amazing how well this technique works, the drill bit doesn’t have to be perfectly centered but because the work piece is spinning around a central axis its near impossible not to get the hole dead centre. I guess this is why a metal lathe has the drill bit set-up in the tail-stock.
Here is the hobbed insert with the central hole:
I am very pleased with the result, as it runs nice and true when rotated. All I have to do now is drill the M3 grub screw hole.
For the purpose of understanding tools like Bison and Flex, I have been building a parser for RapCAD despite the fact that it will probably one day use a library version of OpenSCAD as the back end. My reasons for doing this are two fold, firstly I have never writtern a parser in Bison or a Lexer in Flex before, I have only writtern a trivial Recursive Decent Parser using .NET and Its something I have wanted to try for a while. Secondly I am interested to see how to implement such things as “variables that will”, and functions with function bodies, so that I might sometime provide a patch for OpenSCAD so that it can also do these things.
Things are moving steadily along, and I am now able to parse a simple test file containing the following:
The parser then reads the text and turns it into an abstract syntax tree representation, which is stored in various objects. The objects all have a
toString() method which when called produces following text dump:
Parameters: Param: a Param: b Expression: (Literal: 1 Operator: + Literal: 2 ) Param: c Expression: (Literal: 1 Operator: - Literal: 2 ) Param: d Expression: (Literal: 1 Operator: / Literal: 2 ) Param: e Expression: (Literal: 1 Operator: % Literal: 2 ) Param: f Expression: (Literal: 1 Operator: Literal: 2 ) Param: h Expression: (Literal: 1 Operator: * Literal: 2 )
So, I am thinking about the parsing of functions now, and its got me wondering about function bodies. There is a problem which I am not sure the best way to resolve. I would like to allow a function to have a function body consisting of statements. It would be meaningless however to have a module instance inside a function body, but for the current grammar to work a module instance is a type of statement. I have two options, either re-write my grammar to make a module instance inside a function body as a syntax error, or the other option which would simply be to make the syntax acceptable, but when it comes to evaluate it it will be a compile error.
All this talk of RapCAD hasn’t gone un-noticed by the OpenSCAD maintainer(s). Recently on the OpenSCAD mailing list Marius Kintel has stepped forward and stated that he is now the core maintainer of OpenSCAD. He has also outlined his goals which are similar in essence to my own. Opening up development and try to build a better developer community, as well as hosting better forums/mailing lists bugtrackers and source code management. Based on this and other feedback, I have decided to change my approach somewhat. It doesn’t make all that much sense to duplicate the work of a project that is being actively developed and Marius has agreed that an OpenSCAD evaluation library could benefit multiple projects currently under development. So I will be offering any contributions I can that help OpenSCAD take this direction, and focus on developing RapCAD as a front-end thin wrapper application around this library.
Another motivation for writing RapCAD is to provide a complimentary back end tool for CloudsCAD. As I understand, a number of features have been requested by Tony Buser and the CloudsCAD community and which the OpenSCAD community has been unable to address. I am hoping to build a stronger community by setting up rapcad.org and hosting state of the art bugtracking and source code management tools.
RapCAD is a new script based CAD IDE especially for RepRap printers. Read more over at rapcad.org
RapCAD is a new script based CAD IDE especially for RepRap printers. It will be a written from scratch based mostly on OpenSCAD and hopefully scad scripts will just work inside RapCAD. Ultimately however I would like to add new features to the script language, so that RapCAD files will be a superset of scad files. The IDE will contain project management tools, to allow more than one script to be grouped into a project. Another planned feature is a fully syntax hi-lighted script editor, as well as a 3D visualisation window reminiscent of OpenSCAD. The IDE will also contain gcode visualisation and generation tools as can be found in the esteemed Repsnapper. I am hoping to reap the benefits of combining these two applications into one and allow them to share code, for example slice and dice might be performed using CGAL. But more generally my motivation for doing this is because I would like a one stop app that can be both the design tool, and printing tool without having to go through the intermediary step of having to convert to and from STL. Support for importing from existing STL files will still be available facilitated by an import_stl() function in the script or by some other means.
When I get bored of waiting for someone else to do something I sometimes end up having a go at doing it myself. The hobbed insert in my previous post is no exception
Below is my setup using a drill stand. The 12mm round brass bar is held using a U-Shaped wooden clamp that mounts some 6901ZZ bearings, with an ID of 12mm and an OD of 24mm. I created some dimples on the 12mm brass bar with a punch to create an interference fit in the bearings. This stops things sliding around whilst doing the hobbing. One advantage of the drill stand (which is normally a disadvantage) is that it can swivel around the support pillar. So I was able to push the M3.5 tap closer and closer to the brass bar by pulling the handle to clockwise.
The next problem is how to drill a hole perfectly central down the middle for an m4 tap, again without a lathe. In the meantime the Conrad M4 Inserts have arrived in the worlds most ridiculously over sized box:
I have just completed a successful migration of gilesbathgate.com to a new server. Some headaches were importing the mysql data via the commandline (I gave up in the end and used phpMyAdmin) also lighttpd rewrite rules triped me up, and I forgot to install php5-gd for my wavatars support. But appart from that the migration was seemless, I am sure no one even noticed.