<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>

<p>Thanks for your support.</p>

CC BY-SA 4.0
2022-11-19T02:01:58.427Z
did you ever figure out how to do this with the AppImage or just abandoned it and went to a different installation type?
kjones
CC BY-SA 4.0
2019-03-17T10:48:04.680Z
2019-03-19T10:11:10.503Z
2019-03-19T10:11:10.503Z
Hermann Gebhard
<p>You can specify variable values from command line using:</p>

<pre>
openscad     ...\
             ... \
             [ -D var=val [..] ] \
             ... \
             ... \
             filename
</pre>

<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>

CC BY-SA 4.0
2019-02-19T17:45:03.427Z
2019-02-19T19:15:32.250Z
2019-02-19T19:15:32.250Z
Bouc
<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>

CC BY-SA 4.0
2019-02-19T11:51:30.223Z
If I understand the question right, we are right at the edge of where it is 3D printing and starts to be programming, but still inside: getting the STL is clearly on the OK side imho
Trish
CC BY-SA 4.0
2019-02-19T14:45:58.730Z
Did you run a full cmd-line, e.g. `openscad test.scad -o test.stl` ?
kintel
CC BY-SA 4.0
2019-02-19T15:31:05.843Z
Everything in the GUI works fine.
Hermann Gebhard
CC BY-SA 4.0
2019-02-19T15:33:03.557Z
Yes, I ran a full command line and got an error "could not open file" although the specified SCAD source file exists (copied file name from ls output).
Hermann Gebhard
CC BY-SA 4.0
2019-02-20T22:46:27.680Z
have you tried a fully qualified path?
esoterik
<stl><openscad><linux>
OpenSCAD 2018 Command line
Hermann Gebhard
# OpenSCAD 2018 Command line

(Asked by: username_0 on 2019-02-19)

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.

**Tags:** stl, openscad, linux
> **Comments:**
> **username_1**: If I understand the question right, we are right at the edge of where it is 3D printing and starts to be programming, but still inside: getting the STL is clearly on the OK side imho  
> **username_2**: Did you run a full cmd-line, e.g. `openscad test.scad -o test.stl` ?  
> **username_0**: Everything in the GUI works fine.  
> **username_0**: Yes, I ran a full command line and got an error "could not open file" although the specified SCAD source file exists (copied file name from ls output).  
> **username_3**: have you tried a fully qualified path?  

---

## 2 answers

### Answer by username_0 on 2019-03-17. Score: 3 | Accepted answer

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.

> **Comments:**
> **username_4**: did you ever figure out how to do this with the AppImage or just abandoned it and went to a different installation type?  

---

### Answer by username_5 on 2019-02-19. Score: 4

You can specify variable values from command line using:

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

See the OpenSCAD Manual.


---

