2
$\begingroup$

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.

$\endgroup$
5
  • 1
    $\begingroup$ 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 $\endgroup$
    – Trish
    Feb 19, 2019 at 11:51
  • 1
    $\begingroup$ Did you run a full cmd-line, e.g. openscad test.scad -o test.stl ? $\endgroup$
    – kintel
    Feb 19, 2019 at 14:45
  • $\begingroup$ Everything in the GUI works fine. $\endgroup$ Feb 19, 2019 at 15:31
  • $\begingroup$ 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). $\endgroup$ Feb 19, 2019 at 15:33
  • $\begingroup$ have you tried a fully qualified path? $\endgroup$
    – esoterik
    Feb 20, 2019 at 22:46

2 Answers 2

3
$\begingroup$

You can specify variable values from command line using:

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

See the OpenSCAD Manual.

$\endgroup$
2
$\begingroup$

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.

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .