openscad icon indicating copy to clipboard operation
openscad copied to clipboard

Feature Request: Stl File Name

Open F14Claude opened this issue 3 years ago • 9 comments

It would be usefull to have the possibility to change programatically the suggested stl file name. Something like stloutput = "foo"; instead of the .scad file name. Example: the same file begins by an option for selecting two parts of an object and I want the stl file have two different names without retyping them each time. I know there are other ways to do this (2 source file and a library) but not suitable for me.

F14Claude avatar Aug 02 '22 09:08 F14Claude

Maybe using the command line for that could help. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_OpenSCAD_in_a_command_line_environment

UBaer21 avatar Aug 02 '22 09:08 UBaer21

Would be a last resort but uncomfortable.

F14Claude avatar Aug 02 '22 10:08 F14Claude

There will be no imperative call for naming and/or writing files. A single assignment would also collide with other enhancement requests asking for export of multiple parts to separate files.

The solution needs to be declarative to follow the OpenSCAD behavior, some ideas collected at https://github.com/openscad/openscad/wiki/Meta-Data-Use-Cases

t-paul avatar Aug 02 '22 10:08 t-paul

I understand that this apparently procedural action would countervail OpenSCAD descriptional model. My wish is not to issue an Export operation when the order is reached but only to set the default file name as we do with variable assignation.

F14Claude avatar Aug 02 '22 10:08 F14Claude

The intent is clear, I'm just trying to clarify that variable assignment is problematic for various reasons and there's a different implementation strategy which scales for multi-file export and keeps the declarative nature.

Something like:

module part1() {
  cube();
}

module part2() {
  sphere();
}

@part(name = "the-cube")
part1();

@part(name = "small-sphere")
part2();

t-paul avatar Aug 02 '22 10:08 t-paul

I simply name any modules that make stls something_stl() and then have a Python script that exports them all using the command line.

nophead avatar Aug 02 '22 11:08 nophead

I do similar things with a C# program specially when the same object has to be produced with several different lenghts.

F14Claude avatar Aug 02 '22 11:08 F14Claude

This is in some ways related to the "volumetric color" problem, where you want to track the color of volumes (not faces) and export (among other things) multiple STLs to form a multi-color model.

jordanbrown0 avatar Aug 02 '22 19:08 jordanbrown0

For instance, one could imagine an export mode that was "export separate models for each color, appending the color name to this base name", or another that was "export only <color> parts of the model". "Color" could of course be red, blue, green, but it could also be PLA, PVA (water-soluble filament), TPU (flexible filament), or subcomponent-A, subcomponent-B. The word "color" would no longer be appropriate, but the concept could cover several use cases.

(Dozens of details to be worked out, of course, like how do you say "those parts of subcomponent A that are supposed to be built in red TPU".)

jordanbrown0 avatar Aug 02 '22 22:08 jordanbrown0

Duplicate of #3404.

jordanbrown0 avatar Nov 18 '23 16:11 jordanbrown0

Sorry, incorrect close code. Should have been "closed not planned", which includes "duplicate".

jordanbrown0 avatar Nov 18 '23 21:11 jordanbrown0