Skip to content

Commit

Permalink
Add OpenSCAD (XAMPPRocky#1097)
Browse files Browse the repository at this point in the history
* add OpenSCAD

* update README.md

* test data
  • Loading branch information
kenchou authored and ErikSchierboom committed Jun 7, 2024
1 parent 7fa90f2 commit 8712a95
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ ObjectiveC
ObjectiveCpp
OCaml
Odin
OpenSCAD
OpenQASM
Org
Oz
Expand Down
7 changes: 7 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,13 @@
"multi_line_comments": [["/*", "*/"]],
"quotes": [["\\\"", "\\\""], ["'", "'"]]
},
"OpenScad": {
"name": "OpenSCAD",
"extensions": ["scad"],
"line_comment": ["//"],
"multi_line_comments": [["/*", "*/"]],
"quotes": [["\\\"", "\\\""], ["'", "'"]]
},
"OpenPolicyAgent": {
"name": "Open Policy Agent",
"line_comment": ["#"],
Expand Down
34 changes: 34 additions & 0 deletions tests/data/openscad.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//! 34 lines 15 code 16 comments 3 blanks
// https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Commented_Example_Projects
// The idea is to twist a translated circle:
// -
/*
linear_extrude(height = 10, twist = 360, scale = 0)
translate([1,0])
circle(r = 1);
*/

module horn(height = 10, radius = 6,
twist = 720, $fn = 50)
{
// A centered circle translated by 1xR and
// twisted by 360° degrees, covers a 2x(2xR) space.
// -
radius = radius/4;
// De-translate.
// -
translate([-radius,0])
// The actual code.
// -
linear_extrude(height = height, twist = twist,
scale=0, $fn = $fn)
translate([radius,0])
circle(r=radius);
}

translate([3,0])
mirror()
horn();

translate([-3,0])
horn();

0 comments on commit 8712a95

Please sign in to comment.