Thanks for the reply.
I am trying the drag-n-drop folder approach with a simple two file example.
====
file one - test.jscad
include ("./tube.js");
function main() {
var atube = tube(100,32,30);
return atube;
}
======
========
file two tube.js ( or tube.jscad)
function main(params) {
var atube = tube(params.length,params.outerdiameter,params.innerdiameter);
return atube;
}
function getParameterDefinitions() {
return [
{ name: 'outerdiameter', caption: 'Outer Diameter:', type: 'float', default: 10 },
{ name: 'innerdiameter', caption: 'Inner Diameter:', type: 'float', default: 8 },
{ name: 'length', caption: 'length:', type: 'float', default: 20 },
];
}
function tube(len, od,id)
{
var ocylinder = CSG.cylinder({
start: [0, -len/2, 0],
end: [0, +len/2, 0],
radius: od/2,
resolution: 40 // optional
});
var icylinder = CSG.cylinder({
start: [0, -len/2, 0],
end: [0, +len/2, 0],
radius: id/2,
resolution: 40 // optional
});
var cylinder = ocylinder.subtract(icylinder);
return cylinder;
}
============
These are both in the same directory in my user area. I dragged the directory to the OpenJSCAD.org interface and the result is :
ReferenceError: tube is not defined
Line: 124,col: 0
(blob:https://openjscad.org/d80c6540-7a94-4c8f-b319-51dc761194f2 line 43 > Function)
I am anyway puzzled as to how the interpreter knows which file is the Main one to execute.
I have tried with Firefox 79 for Ubuntu and Chromium Version 84.0.4147.105 (Official Build) Built on Ubuntu , running on Ubuntu 18.04 (64-bit) with the included file both as .js and as .jscad