<p>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. </p>

<p>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.</p>

<p>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".</p>

<p>Here is my M(N)WE:</p>

<pre><code>// 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);  
}
</code></pre>

<p>Any help will greatly be appreciated.</p>

[{'answer_id': 8302, 'author': 'Bouc', 'author_id': 14584, 'author_profile': 'https://3dprinting.stackexchange.com/users/14584', 'pm_score': 2, 'selected': False, 'text': '<p>You can specify variable values from command line using:</p>\n\n<pre>\nopenscad     ...\\\n             ... \\\n             [ -D var=val [..] ] \\\n             ... \\\n             ... \\\n             filename\n</pre>\n\n<p>See the <a href="https://en.m.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_OpenSCAD_in_a_command_line_environment" rel="nofollow noreferrer">OpenSCAD Manual</a>.</p>\n'}, {'answer_id': 8484, 'author': 'Hermann Gebhard', 'author_id': 10070, 'author_profile': 'https://3dprinting.stackexchange.com/users/10070', 'pm_score': 3, 'selected': True, 'text': '<p>I could finally solve the issue. Calling <code>openscad</code> from command line with parameters does NOT work with the AppImage I used. It works fine with a "standard" installation, though.</p>\n\n<p>Thanks for your support.</p>\n'}]
['https://3dprinting.stackexchange.com/questions/8301', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/10070/']