Using Codification to produce OpenSCAD scripts

I'd like to be able to use Snap! to construct OpenSCAD scripts (text processing language that produces 3D models)

But I need a bit of help to get started as I don't seem to be able to quite grasp what to do :frowning:

I'd like this sort of Snap! construct

untitled script pic (81)

to produce this sort of text ouput

color([1,0,0])translate([0,0,10])cube([20,20,20]);

This makes a cube 20mm on each side then moves it up 10mm) and then colours it red

I only need the line command block and say the color reporter - I can work the others out if I had those :slight_smile:

[edit]
If the variadic line command block can't be done then I could resort to this sort of construct

untitled script pic (82)

[edit]18th Mar 23 - I've got this far myself by modifying the Codification example (specifically the JavaScript mapping)
Codification script pic (3)

[edit2] a little bit later ....
I've got it working :slight_smile:

The variadic line block adds , between each item so I came up with a kludge to add in the ¬ char on the output of each reporter and then do a search and replace for ¬, to remove them (plus a search and replace for the trailing ¬ one as well) :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.