diff --git a/snipMate/openscad.snippets b/snipMate/openscad.snippets new file mode 100644 index 0000000..3e4efa6 --- /dev/null +++ b/snipMate/openscad.snippets @@ -0,0 +1,381 @@ +# converted from http://www.thingiverse.com/thing:67566 +# which is an extension of http://www.thingiverse.com/thing:15292 +# +# added some missing snippets and cleaned things + +# +snippet ass + assign (${1:x} = ${2:0}) { + ${3} + } + + +# +snippet cir + circle(r=${1:10}, $fn=FN); + +# +snippet col + color([${1:0}/255, ${2:0}/255, ${3:0}/255]) { + ${4} + } + +# +snippet cu + cube(size=[${1:10}, ${2:10}, ${3:10}], center=${4:false}); + +# +snippet cyl + cylinder(h=${1:10}, r=${2:10}, $fn=FN, center=${3:true}); + +snippet diff + difference(){ + ${1} + } + +# +snippet echo + echo(str("${1:Variable = }", ${2:x})); + +# (...){...} +snippet for (...){...} + for (${20:i}=[${1:0}:${2:10}]) { + ${3} + } + + +# +snippet fun + function ${1:function_name}(${2:args}) = ${3:// body...}; + +# Displays the convex hull of child nodes. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#hull +snippet hul + hull() { + ${1} + } + +# ...else +snippet ife ...else + if (${1:true}) { + ${2} + } else { + + } + +# +snippet if + if (${1:true}) { + ${2} + } + +# +snippet is + import_stl("${1:filename.stl}", convexity=${2:10}); + +# +snippet inc + include <${1:filename.scad}> + +snippet int + intersection(){ + ${1} + } + +# (...){...} +snippet ifor (...){...} + for (${20:i} = [${1:0}:${2:10}]) { + ${3} + } + + +# +snippet le + linear_extrude(height=${1:10}, center=${2:true}, convexity=${3:10}, twist=${4:0}) { + ${5} + } + +# Displays the minkowski sum of child nodes. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_Language#minkowski +snippet mink + minkowski() { + ${1} + } + +# +snippet mir + mirror([${1:0}, ${2:0}, ${3:0}]) { + ${4} + } + + +# +snippet mod + module ${1:module_name}(${2:args}) { + ${3:// body...} + } + +# +snippet mul + multimatrix([ + [${1:1}, ${2:0}, ${3:0}, ${4:10}], + [${5:0}, ${6:1}, ${7:0}, ${8:20}], + [${9:0}, ${10:0}, ${11:1}, ${12:30}], + [${13:0}, ${14:0}, ${15:0}, ${16:1}] + ]) { + ${17} + } + + +# +snippet polyg + polygon(points=[${1:[0,0],[100,0],[0,100],[10,10],[80,10],[10,80]}], paths=[${2:[0,1,2],[3,4,5]}]); + + +# +snippet poly + polyhedron(points=[${1:[0,0,0],[100,0,0],[0,100,0],[0,100,100]}], triangles=[${2:[0,1,2],[1,0,3],[0,2,3],[2,1,3]}]); + +# +snippet proj + projection(cut=${1:true}) import_stl("${2:filename.stl}"); + + +# +snippet ren + render() { + ${1} + } + + +# +snippet r + rotate([${1:0}, ${2:0}, ${3:0}]) ${4} + +# {...} +snippet rot {...} + rotate([${1:0}, ${2:0}, ${3:0}]) { + ${4} + } + + +# +snippet re + rotate_extrude(convexity=${1:10}) { + ${2} + } + +# +snippet s + scale([${1:1}, ${2:1}, ${3:1}]) ${4} + +# {...} +snippet sca {...} + scale([${1:1}, ${2:1}, ${3:1}]) { + ${4} + } + +# +snippet sph + sphere(r=${1:10}, $fn=FN); + +# +snippet squ + square(size=[${1:10}, ${2:10}], center=${3:true}); + +# +snippet surf + surface(file="${1:filename.dat}", center=${2:true}${3:, convexity=5}); + + +# +snippet t + translate([${1:0}, ${2:0}, ${3:0}]) ${4} + +# {...} +snippet tran {...} + translate([${1:0}, ${2:0}, ${3:0}]) { + ${4} + } + +snippet union + union(){ + ${1} + } + +# +snippet use + use <${1:filename.scad}> + +######################################################################### +# Write snippets (http://www.thingiverse.com/thing:16193) +######################################################################### + +# Write +snippet write + write("${1:text}",h=${2:height},t=${3:thickness},font="${4:font_name}, space=${5:font_spacing}"); + +# Write Circle +snippet writecircle Circle + writecircle("${1:text}",[${2:0},${3:0},${4:0}],${5:radius}); + +# Write Cube +snippet writecube Cube + writecube("${1:text}",[${2:0},${3:0},${4:0}],[${5:0},${6:0},${7:0}],face="${8:top}"); + +# Write Cylinder +snippet writecylinder Cylinder + writecylinder("${1:text}",[${2:0},${3:0},${4:0}],${5:0},${6:0},rotate=${7:0},face=${8:top},center=${9:true}); + +# Write Sphere +snippet writesphere Sphere + writesphere("${1:text}",[${2:0},${3:0},${4:0}],${5:0}); + +######################################################################### +# MCAD snippets (http://reprap.org/wiki/MCAD) +######################################################################### + +# MCAD ComplexRoundSquare +snippet complexroundsqaure ComplexRoundSquare + complexRoundSquare(${1:size},rads1=[${2:0},${3:0}], rads2=[${4:0},${5:0}], rads3=[${6:0},${7:0}], rads4=[${8:0},${9:0}], center=${10:true}); + +# MCAD DonutSlice +snippet donutslice DonutSlice + donutSlice(${1:innerSize},${2:outerSize}, ${3:start_angle}, ${4:end_angle}); + +# MCAD Ellipse +snippet ellipse Ellipse + ellipse(${1:width}, ${2:height}); + +# MCAD EllipsePart +snippet ellipsepart EllipsePart + ellipsePart(${1:width},${2:height},${3:numQuarters}); + +# MCAD ngon +snippet ngon ngon + ngon(${1:sides}, ${2:radius}, center=${3:false}); + +# MCAD PieSlice +snippet pieslice PieSlice + pieSlice(${1:size}, ${2:start_angle}, ${3:end_angle}); + +# MCAD RoundedSquare +snippet roundedsquare RoundedSquare + roundedSquare(pos=[${1:0},${2:0}],r=${3:2}); + +# MCAD Box +snippet roundedbox Box + roundedBox([${1:width}, ${2:height}, ${3:depth}], ${4:float_radius}, ${5:bool_sidesonly}); + +# MCAD gridbeam backBoard +snippet backboard Board + backBoard(${1:width}, ${2:depth}, ${3:corners}); + +# MCAD gridbeam bottomShelf +snippet bottomshelf Shelf + bottomShelf(${1:width}, ${2:depth}, ${3:corners}); + +# MCAD gridbeam frontBoard +snippet frontboard Board + frontBoard(${1:width}, ${2:depth}, ${3:corners}); + +# MCAD gridbeam topShelf +snippet topshelf Shelf + topShelf(${1:width}, ${2:depth}, ${3:corners}); + +# MCAD gridbeam translateBeam +snippet translatebeam Beam + translateBeam([${1:x}, ${2:y}, ${3:z}]); + +# MCAD gridbeam xbeam +snippet xbeam + xBeam(${1:segments}); + +# MCAD gridbeam ybeam +snippet ybeam + yBeam(${1:segments}); + +# MCAD gridbeam zbeam +snippet zbeam + zBeam(${1:segments}); + +# MCAD involutegears bevelGear +snippet bevelgear Gear + bevel_gear (number_of_teeth=${1:0}, cone_distance=${2:0}, face_width=${3:0}, outside_circular_pitch=${4:0}, pressure_angle=${5:0}, clearance = ${6:0}, bore_diameter=${7:0}, gear_thickness = ${8:0}, backlash = ${9:0}, involute_facets=${10:0}, finish = ${11:0}); + +# MCAD involutegears bevelGearPair +snippet bevelgearpair GearPair + bevel_gear_pair (gear1_teeth = ${1:0}, gear2_teeth = {$2:0}, axis_angle = ${3:0}, outside_circular_pitch=${4:0}); + +# MCAD involutegears gear +snippet gear + gear (circular_pitch=${1:0}, gear_thickness = ${2:0}, rim_thickness = ${3:0}, hub_thickness = ${4:0}, circles=${5:0}); + + +######################################################################### +# Customizer snippets +######################################################################### + +# Customizer DropDownBox +snippet custdrop DropDownBox + // ${1:Drop Down Box Description} + ${2:variable} = ${3:default_value}; // [${4:1},${5:2},${6:3}] + +# Customizer DefaultPreview +snippet custpreview DefaultPreview + // preview[view:${1:south}, tilt:${2:top}] + +# Customizer Slider +snippet custslider Slider + + // ${1:Slider Description} + ${2:variable} = ${3:default_value}; // [${4:0}:${5:10}] + +# Customizer TabName +snippet custtab TabName + /* [${1:Tab Name}] */ + +# Customizer Libraries +snippet customizerlibraries Libraries + // Uncomment the library/libraries of your choice to include them + // use + // use + // use + // use + + +######################################################################### +# BuildPlate snippets (http://www.thingiverse.com/thing:44094) +######################################################################### + +# Plate +snippet buildplate Plate + //for display only, doesn't contribute to final object + build_plate_selector = 0; //[0:Replicator 2,1: Replicator,2:Thingomatic,3:Manual] + + //when Build Plate Selector is set to "manual" this controls the build plate x dimension + build_plate_manual_x = 100; //[100:400] + + //when Build Plate Selector is set to "manual" this controls the build plate y dimension + build_plate_manual_y = 100; //[100:400] + + build_plate(build_plate_selector,build_plate_manual_x,build_plate_manual_y); + + +######################################################################### +# pins snippets (http://www.thingiverse.com/thing:10541) +######################################################################### + +# +snippet pin + pin(h=${1:shaft_height}, r=${2:shaft_radius}, lh=${3:lip_height}, lt=${4:lip_thickness}, side=${5:true}); + +# Hole +snippet pinhole Hole + pinhole(h=${1:shaft_height}, r=${2:shaft_radius}, lh=${3:lip_height}, lt=${4:lip_thickness}, t=${5:tolerence}, tight=${6:tight}); + +# Peg +snippet pinpeg Peg + pinpeg(h=${1:shaft_height}, r=${2:shaft_radius}, lh=${3:lip_height}, lt=${4:lip_thickness}); + +# Tack +snippet pintack Tack + pintack(h=${1:shaft_height}, r=${2:shaft_radius}, lh=${3:lip_height}, lt=${4:lip_thickness}, bh=${5:base_height}, br=${6:base_radius});