3

First, I'm using Linux Mint 18.3 (Sylvia). Until now, I've been using OpenSCAD with the GUI and never experienced issues. Now I try to start OpenSCAD from the command line, but it always opens an empty file, even if a file with the specified name exists.

Since I have a rather big script, I'd like to generate the STL's via the CLI. Due to this error, I can not even do any tests for parameter passing.

What I'd like to do is to issue a command (flom the command line or in a shell script) that says "Set objectID to 1, render and export the result to stl".

Here is my M(N)WE:

// test.scad

objectID = 2;


if (objectID == 1)  
difference(){  
    cylinder(d=20, h=50, center=true);  
    cylinder(d=16, h=50.2, center=true);      
}

else if (objectID == 2)  
difference(){  
    cube(50, center=true);  
    cube([35,35,70], center=true);  
}

Any help will greatly be appreciated.

2 Answers2

4

You can specify variable values from command line using:

openscad     ...\
             ... \
             [ -D var=val [..] ] \
             ... \
             ... \
             filename

See the OpenSCAD Manual.

0scar
  • 32,029
  • 10
  • 59
  • 135
Bouc
  • 41
  • 1
3

I could finally solve the issue. Calling openscad from command line with parameters does NOT work with the AppImage I used. It works fine with a "standard" installation, though.

Thanks for your support.

0scar
  • 32,029
  • 10
  • 59
  • 135
  • did you ever figure out how to do this with the AppImage or just abandoned it and went to a different installation type? – kjones Nov 19 '22 at 02:01