vscode-openscad icon indicating copy to clipboard operation
vscode-openscad copied to clipboard

Enhancment: New Auto Naming Format Feature

Open RAMilewski opened this issue 10 months ago • 1 comments

Not entirely sure this is possible but....

It would be a huge help if it were possible to set the export file basename to the value of an OpenSCAD variable.

I frequently build projects with more than one part in the file and use the Customizer to select which one to render.

If I could set a $variable to the name of the part it would save a lot of renaming at export time.

RAMilewski avatar Aug 21 '23 19:08 RAMilewski

Yes, this has been a goal of mine to add since the beginning and I would love to have it as a part of the extension.

The way I have in mind for this to work is that there would be a file-level override for the export name format (autoNamingExport seemed like a good name at the time, but in hindsight is terrible) in a comment at the top of the file. Something like:

// exportName=cube${var:size}.${exportExtension}
size = 10;
cube(size);

I think this feature may require a language server to be implemented so that the extension can gain access to variable definitions, so that is my next goal. There have been talks of this in several other issues. It is probably worth restarting one of those issues back up or making a new one. I am currently busy with grad school, so I don't know when I will have time to work on this, but PRs are always welcome!

Antyos avatar Aug 24 '23 19:08 Antyos