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.39k stars 142 forks source link

OpenSCAD variable/parameter typos seem to be silent #241

Closed Digital-Monk closed 4 years ago

Digital-Monk commented 4 years ago

If my OpenSCAD code has typos, extopenscad seems to silently fail on the affected expression/statement. This has been a problem when I messed up capitalization on a variable, and also when I tried to use the 'd' diameter parameter in cylinders and spheres (I guess only the 'r' radius parameter is supported for now). OpenSCAD would also continue on with the code, but it issued warnings about the unrecognized variables/parameters.

(Hopefully I'm not just being an idiot and somehow hiding these warnings)

julialongtin commented 4 years ago

Mind passing me some more concrete examples?

Digital-Monk commented 4 years ago

Here's the simplest. Note the failure to capitalize properly in the sphere usage.

camelCase = 10; sphere(r = camelcase);

extopenscad will say "no objects to render", but won't mention that 'camelcase' is an unrecognized symbol.

lepsa commented 4 years ago

Hi Digital-Monk, I've been unable to reproduce this in commit e999aa48f9d13e55a4b65e58b41d526d51b267fb. Do you know which version/commit of ImplicitCAD you are running?

Output with bad casing.

[nix-shell:~/git/ImplicitCAD]$ cat bar.escad 
camelCase = 10;
sphere(r = camelcase);

[nix-shell:~/git/ImplicitCAD]$ cabal new-run extopenscad -- bar.escad 
Up to date
Loading File.
Processing File.
No objects to render.
Error at line 2, column 1: Variable camelcase not in scope
Error at line 2, column 1: arg Undefined not compatible with Symbol "r"

Output with good casing

[nix-shell:~/git/ImplicitCAD]$ cat bar.escad 
camelCase = 10;
sphere(r = camelCase);

[nix-shell:~/git/ImplicitCAD]$ cabal new-run extopenscad -- bar.escad 
Up to date
Loading File.
Processing File.
Rendering 3D object from bar.escad to bar.stl with resolution 0.909090909090909 in box ((-10.0,-10.0,-10.0),(10.0,10.0,10.0))
Sphere 10.0

[nix-shell:~/git/ImplicitCAD]$ cat bar.stl 
<snipped due to length and unicode replacement chartacters>
Digital-Monk commented 4 years ago

I'm running whatever 0.2.0 comes out of cabal install implicit... Definitely not the same as what you're running, because the build I've got puts "In box [...]" on a line by itself instead of at the end of the "Rendering ..." line.

Sorry, I'm not very familiar with haskell or cabal...

lepsa commented 4 years ago

No worries. That version of implicit is rather old, coming up to two years in May! We should really update the version on hackage or update the readme to let people know where/how to get a newer copy. I don't have access to do that, but Julia certainly does.

Digital-Monk commented 4 years ago

Just curious: What version is running for the online demo on implicitcad.org?

lepsa commented 4 years ago

I do not know offhand, and a few minutes of digging didn't turn up anything. However, it does handle the casing and function declaration issues.

Digital-Monk commented 4 years ago

Sounds like this issue is definitely closed, though :) Ancient history