[OpenSCAD] Abbreviations

runsun runsun at gmail.com
Wed Jun 8 16:05:35 EDT 2016


buttim wrote
> *Full list of abreviations (the | character is not included but shows
> where
> the caret will be positioned):
> c cube([|]);
> d difference() {\n\t|\n}
> f for (i=[|]) {\n\t\n}
> i intersection() {\n\t|\n}
> m module |() {\n\t\n}
> r rotate([|]);
> s sphere(r=|);
> t translate([|])
> u union() {\n\t|\n}
> x ,center=true|
> y cylinder(r=|,h=);

Cool! Since we are here, some more ideas that I have in mind for a while: 

 Note that cube() can be used in the following ways:

   cube();
   cube(center=true);
   cube(3);
   cube(3, center=true);
   cube([2,3,4]);
   cube([2,3,4], center=true);

That is, total of 6 ways of usage. But the shortcut presented in this thread
only handles one. It would mean that if a user gets used to that shortcut,
he/she will have to manually delete [ ] to proceed in many cases.  To me it
introduces additional mental barrier: first has to remember ctrl-B, then
secondly has to remember when to and not to use ctrl-B, then if that fail,
has to spend more key strokes to clean up, which means significant slowing
down and thus a backward approach. This happens, of course, in other
function/modules. 

My suggestion, therefore, is:

  c ==> [TAB] => cube(size=|);   // user can either type number or [ . Note
that the argument name is shown. This will be a huge help especially for new
users.

  If user types a number ==> cube(size=3|); 
  or a vector ==> cube( size=[2,3,4]|);

Note that the cursor is still within ( ). At this moment, hit "," brings
you:

  cube(size=3, center=true|);
  cube(size=[3,4,5], center=true|);

At this moment, user can hit either [TAB] or ",":

  : "," will jump the cursor to the end:

    cube(size=3, center=true); |
    cube(size=[3,4,5], center=true); |

  : and [TAB] will cycle through permitted values of the last argument: 

    cube(size=3, center=false|); 
    cube(size=[3,4,5], center=false|); 

So this pattern, *[TAB] for cycling values and "," for next argument*, will
be followed in ALL function/module, making it a universal usage, no matter
if it's shortcut or not.

  



-----

$  Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 );   $ tips: hash ( 2 ), matrix ( 2 ), sweep ( 2 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2, 3 ), isosphere , area , vol/center , RGB 
--
View this message in context: http://forum.openscad.org/Abbreviations-tp17583p17606.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list