Haskell-Things / ImplicitCAD

A math-inspired CAD program in haskell. CSG, bevels, and shells; 2D & 3D geometry; 2D gcode generation...
https://implicitcad.org/
GNU Affero General Public License v3.0
1.41k stars 142 forks source link

Cannot add vectors like in OpenSCAD #401

Closed mokshasoft closed 2 years ago

mokshasoft commented 2 years ago

The following code works in OpenSCAD but not in ImplicitCAD:

coord1 = [0, 0, 0];
coord2 = [1, 0, 0];
coord3 = coord1 + coord2;

translate(coord3)
cube(size = 1, center = true);

Compilation log:

% extopenscad -o test.stl --fopenscad-compat test.escad
Loading File.
Processing File.
No objects to render.
Error at line 3, column 1: Can't apply arguments to Number
Error at line 5, column 1: Variable coord3 not in scope
Error at line 5, column 1: arg Undefined not compatible with Symbol "v"
<<ghc: 1605056 bytes, 2 GCs, 251832/251832 avg/max bytes residency (1 samples), 18M in use, 0.001 INIT (0.007 elapsed), 0.001 MUT (0.002 elapsed), 0.001 GC (0.001 elapsed) :ghc>>
% echo $?
0

I installed the extopenscad via cabal install the last couple of days on my Macbook pro.

julialongtin commented 2 years ago

nice catch! should be a quick fix. sorry for the delay.

sorki commented 2 years ago

Fixed in head but note that another one related to this popped-up - matrix multiplication is not supported #414.