Is there any way to pop up the Templates list from an OpenSCAD menu?
Why does one need to double-click to select an item from the Templates
list, when one normally single-clicks to select from a list?
When I go to the Help menu and then Library Info, I see a lot of paths,
but the Template Path is not present. Which of the listed paths are
Templates stored under?
Thanks
Jon
On 2025-05-25 10:10, Torsten Paul via Discuss wrote:
It's not fully automatic, but maybe a bit more flexible...
Create a "templates" subfolder in the configuration directory,
e.g. on Linux: $HOME/.config/OpenSCAD/templates
Into that folder, put a file, e.g. called header.json with the
following content (including the curly braces)
{
"key" : "MyHeader",
"content" : "// Hi There!\n// This is my very special
template\n\n^~^"
}
Use ALT+Ins (no idea what that would be on macOS), or use
mouse right-click -> insert template. Select "MyHeader" in
the popup.
The "^~^" is the marker where to place the cursor.
ciao,
Torsten.
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
Can't answer the first two questions Jon, but on my w10 machine, I found my templates under program files\openscad (nightly)\templates
On 2025-05-28 20:53, Jon Bondy wrote:
Is there any way to pop up the Templates list from an OpenSCAD menu?
Why does one need to double-click to select an item from the Templates list, when one normally single-clicks to select from a list?
When I go to the Help menu and then Library Info, I see a lot of paths, but the Template Path is not present. Which of the listed paths are Templates stored under?
Thanks
Jon
On 2025-05-25 10:10, Torsten Paul via Discuss wrote:
It's not fully automatic, but maybe a bit more flexible...
Create a "templates" subfolder in the configuration directory,
e.g. on Linux: $HOME/.config/OpenSCAD/templates
Into that folder, put a file, e.g. called header.json with the
following content (including the curly braces)
{
"key" : "MyHeader",
"content" : "// Hi There!\n// This is my very special template\n\n^~^"
}
Use ALT+Ins (no idea what that would be on macOS), or use
mouse right-click -> insert template. Select "MyHeader" in
the popup.
The "^~^" is the marker where to place the cursor.
ciao,
Torsten.
A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!
Any files under the Program Files folder are very difficult to modify. On my windows machine, I was able to put them here:
C:\Users\jon\AppData\Local\OpenSCAD\templates
That said, it would be helpful if the locations where templates could exist were clearly labeled in the Help
Jon
On 5/28/2025 7:03 AM, Ken wrote:
Can't answer the first two questions Jon, but on my w10 machine, I found my templates under program files\openscad (nightly)\templates
On 2025-05-28 20:53, Jon Bondy wrote:
Is there any way to pop up the Templates list from an OpenSCAD menu?
Why does one need to double-click to select an item from the Templates list, when one normally single-clicks to select from a list?
When I go to the Help menu and then Library Info, I see a lot of paths, but the Template Path is not present. Which of the listed paths are Templates stored under?
Thanks
Jon
On 2025-05-25 10:10, Torsten Paul via Discuss wrote:
It's not fully automatic, but maybe a bit more flexible...
Create a "templates" subfolder in the configuration directory,
e.g. on Linux: $HOME/.config/OpenSCAD/templates
Into that folder, put a file, e.g. called header.json with the
following content (including the curly braces)
{
"key" : "MyHeader",
"content" : "// Hi There!\n// This is my very special template\n\n^~^"
}
Use ALT+Ins (no idea what that would be on macOS), or use
mouse right-click -> insert template. Select "MyHeader" in
the popup.
The "^~^" is the marker where to place the cursor.
ciao,
Torsten.
A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!
Help->Library Info shows the base path.
User Templates: "User Config Path"/templates
Shipped templates: "Resource Path"/templates
ciao,
Torsten.
On 5/28/2025 3:53 AM, Jon Bondy via Discuss wrote:
Is there any way to pop up the Templates list from an OpenSCAD menu?
Right click, Insert Template.
Why does one need to double-click to select an item from the Templates
list, when one normally single-clicks to select from a list?
Don't know. Probably just that it's a rarely-used feature and nobody
has really tuned it up to operate in the best possible way. Note also
that the template popup is not a menu.
The fastest way to use it is probably Alt+Ins to pop it, arrow keys to
select, and Enter to select.
When I go to the Help menu and then Library Info, I see a lot of
paths, but the Template Path is not present. Which of the listed
paths are Templates stored under?
Torsten's already given a good answer, Help/Library Info, but it might
be good if that were to explicitly list the various subdirectories that
are available under the config path. It might be better still if
File/Show Library Folder were extended to show various other relevant
folders, and if the "templates" subdirectory was automatically created
in the user config directory. Best of course would be a UI to create,
read, update, and delete templates.
On Wed, 2025-05-28 at 09:37 -0700, Jordan Brown via Discuss wrote:
On 5/28/2025 3:53 AM, Jon Bondy via Discuss wrote:
Is there any way to pop up the Templates list from an OpenSCAD
menu?
Right click, Insert Template.
Yeah! That's a lot easier on my Linux box with a compact keyboard. I
have been using Alt+FN+Insert. Insert is a function on the F11 key.
Why does one need to double-click to select an item from the
Templates list, when one normally single-clicks to select from a
list? Don't know. Probably just that it's a rarely-used feature
and nobody has really tuned it up to operate in the best possible
way. Note also that the template popup is not a menu.
The fastest way to use it is probably Alt+Ins to pop it, arrow keys
to select, and Enter to select.
That, and double-click are what I use. I don't mind either one.
One thing though. I have, in my
.config/OpenSCAD/templates.config/OpenSCAD/templates
directory, a file called module.json
It contains
{
"key" : "module",
"content" : "module ^~^ () {\n\n}"
}
But it doesn't show up in the list. Any idea why?
When I go to the Help menu and then Library Info, I see a lot of
paths, but the Template Path is not present. Which of the listed
paths are Templates stored under?
Torsten's already given a good answer, Help/Library Info, but it
might be good if that were to explicitly list the various
subdirectories that are available under the config path. It might be
better still if File/Show Library Folder were extended to show
various other relevant folders, and if the "templates" subdirectory
was automatically created in the user config directory. Best of
course would be a UI to create, read, update, and delete templates.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 5/28/2025 2:08 PM, larry via Discuss wrote:
One thing though. I have, in my
.config/OpenSCAD/templates.config/OpenSCAD/templates
directory, a file called module.json
It contains
{
"key" : "module",
"content" : "module ^~^ () {\n\n}"
}
But it doesn't show up in the list. Any idea why?
You do know that OpenSCAD includes a "module" template in the
distribution, right?
On Windows, it's in C:\Program Files\OpenSCAD\templates\module.json, and
it's almost identical to the one you quoted.
I assume that the "key" needs to be unique.
On Wed, 2025-05-28 at 15:05 -0700, Jordan Brown wrote:
On 5/28/2025 2:08 PM, larry via Discuss wrote:
One thing though. I have, in my
.config/OpenSCAD/templates.config/OpenSCAD/templates
directory, a file called module.json
It contains
{
"key" : "module",
"content" : "module ^~^ () {\n\n}"
}
But it doesn't show up in the list. Any idea why?
You do know that OpenSCAD includes a "module" template in the
distribution, right?
On Windows, it's in C:\Program Files\OpenSCAD\templates\module.json,
and it's almost identical to the one you quoted.
I am running a Linux Appimage, and there was no 'module' template that
came with it.
I assume that the "key" needs to be unique.
I have found out that the templates I put into
~/.config/OpenSCAD/templates override the ones in the AppImage.
So it is unique.
On 5/29/2025 8:24 PM, larry via Discuss wrote:
But it doesn't show up in the list. Any idea why?
Sorry, no idea. (I could fire up a Linux VM, but I'd have to run an
OpenSCAD that I built since I don't know beans about AppImages, and
there's a good chance the details would all be different.)
On Fri, 2025-05-30 at 00:27 -0700, Jordan Brown wrote:
On 5/29/2025 8:24 PM, larry via Discuss wrote:
But it doesn't show up in the list. Any idea why?
Sorry, no idea. (I could fire up a Linux VM, but I'd have to run an
OpenSCAD that I built since I don't know beans about AppImages, and
there's a good chance the details would all be different.)
Thanks Jordan.