[OpenSCAD] new "Special Variable"?

Yvette S. Hirth, CCP, CDP yvette at dbtgroup.com
Tue May 5 11:31:42 EDT 2015


any way we can get the filename(s) being built stuffed into a special 

like, say, $fileName?  or $fileNameArray?

i don't know if you can build more than one input file at a time; all my 
.scad files are "one file per thing being built".  i do use <include> 
and <use>, but only one input file.  so if only one input file can be 
built, then $fileName is more appropriate; if multiple input files can 
be built, then $fileNameArray is more appropriate.

yes?  non?  eh?


in each piece i build i stomp an "Engineering Change" (ec) level, along 
with the version.

e.g., a build file for ec0 might be named:  wondafulWidget_003.scad

so i stomp "ec0_003" in the item being built; makes it easier to trace 
"what made this thing?" issues.

now i have to manually change the write() that stomps the ec tag.  while 
i'm not complaining about the workload (!), nonetheless, i've forgotten 
to change the string in the write() several times when i do a "Save As". 
  ex:  Save As "wondafulWidget_004.scad" has the item being built still 
stomped with "ec_003".  <big sigh>  a good waste of time, carbon, and ABS!

with the $fileName special variable, i can substring to the version, 
glom the version into a variable, and stomp the variable.  that ends any 
confusion as to "what made what".

thanks for listening!

More information about the Discuss mailing list