discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

How do I edit/create code snippets?

R
rjcarlson49
Tue, May 18, 2021 1:14 AM

The 2021 release allows the insertion of code snippets. I can't find any
information in the docs about this other that to use alt-ins to insert a
snippet. Some questions.

  1. The option key on the mac subs for alt, but where is the ins(ert?) key?
  2. How do I create a new snippet?
  3. How do I edit an existing snippet?

-Bob

--
Sent from: http://forum.openscad.org/

The 2021 release allows the insertion of code snippets. I can't find any information in the docs about this other that to use alt-ins to insert a snippet. Some questions. 1) The option key on the mac subs for alt, but where is the ins(ert?) key? 2) How do I create a new snippet? 3) How do I edit an existing snippet? -Bob -- Sent from: http://forum.openscad.org/
TP
Torsten Paul
Sun, May 23, 2021 12:45 AM

On 18.05.21 03:14, rjcarlson49 wrote:

  1. The option key on the mac subs for alt, but where is the
    ins(ert?) key?

No idea where that key is on Mac, but the code snippets can
be also inserted via context menu (normally right click in
the editor, wherever that is on Mac, probably CTRL+Click?)

  1. How do I create a new snippet?

There's no GUI for that yet. Maybe that will happen at some
point but right now it's all manual work.

  1. Go to config directory (create if it does not exist)

The folder name can be found in Help->Library Info->User
Config Path

  1. Create a subfolder called "templates"

  2. Create a text file with extension .json, for example:

File name: points.json
Content:
{
"key" : "points",
"content" : "points = [ for (a = [0:5:359]) 1^~^ * [ -sin(x), cos(x) ] ]"
}

The 3 chars ^~^ indicate where the cursor will end up
after the text was inserted at the current cursor location.

  1. How do I edit an existing snippet?

Those are stored in the Application Bundle, so it might be
possible to edit those by "Show Package Content" and going
into the Contents/Resources/templates folder. I'm not sure
if that's a good option though.

For reference the files shipped in the application are:
https://github.com/openscad/openscad/tree/master/templates

ciao,
Torsten.

On 18.05.21 03:14, rjcarlson49 wrote: > 1) The option key on the mac subs for alt, but where is the > ins(ert?) key? No idea where that key is on Mac, but the code snippets can be also inserted via context menu (normally right click in the editor, wherever that is on Mac, probably CTRL+Click?) > 2) How do I create a new snippet? There's no GUI for that yet. Maybe that will happen at some point but right now it's all manual work. 1) Go to config directory (create if it does not exist) The folder name can be found in Help->Library Info->User Config Path 2) Create a subfolder called "templates" 3) Create a text file with extension .json, for example: File name: points.json Content: { "key" : "points", "content" : "points = [ for (a = [0:5:359]) 1^~^ * [ -sin(x), cos(x) ] ]" } The 3 chars ^~^ indicate where the cursor will end up after the text was inserted at the current cursor location. > 3) How do I edit an existing snippet? Those are stored in the Application Bundle, so it might be possible to edit those by "Show Package Content" and going into the Contents/Resources/templates folder. I'm not sure if that's a good option though. For reference the files shipped in the application are: https://github.com/openscad/openscad/tree/master/templates ciao, Torsten.
MM
Michael Marx
Sun, May 23, 2021 1:15 AM

-----Original Message-----
From: Torsten Paul [mailto:Torsten.Paul@gmx.de]
Sent: Sun, 23 May 2021 10:45
To: discuss@lists.openscad.org
Subject: [OpenSCAD] Re: How do I edit/create code snippets?

On 18.05.21 03:14, rjcarlson49 wrote:

  1. The option key on the mac subs for alt, but where is the
    ins(ert?) key?

No idea where that key is on Mac, but the code snippets can
be also inserted via context menu (normally right click in
the editor, wherever that is on Mac, probably CTRL+Click?)

  1. How do I create a new snippet?

There's no GUI for that yet. Maybe that will happen at some
point but right now it's all manual work.

  1. Go to config directory (create if it does not exist)

The folder name can be found in Help->Library Info->User
Config Path

  1. Create a subfolder called "templates"

  2. Create a text file with extension .json, for example:

File name: points.json
Content:
{
"key" : "points",
"content" : "points = [ for (a = [0:5:359]) 1^~^ * [ -sin(x), cos(x) ] ]"
}

The 3 chars ^~^ indicate where the cursor will end up
after the text was inserted at the current cursor location.

  1. How do I edit an existing snippet?

Those are stored in the Application Bundle, so it might be
possible to edit those by "Show Package Content" and going
into the Contents/Resources/templates folder. I'm not sure
if that's a good option though.

For reference the files shipped in the application are:
https://github.com/openscad/openscad/tree/master/templates

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

https://www.passfab.com/mac/insert-key-on-macbook-keyboard.html > -----Original Message----- > From: Torsten Paul [mailto:Torsten.Paul@gmx.de] > Sent: Sun, 23 May 2021 10:45 > To: discuss@lists.openscad.org > Subject: [OpenSCAD] Re: How do I edit/create code snippets? > > On 18.05.21 03:14, rjcarlson49 wrote: > > 1) The option key on the mac subs for alt, but where is the > > ins(ert?) key? > > No idea where that key is on Mac, but the code snippets can > be also inserted via context menu (normally right click in > the editor, wherever that is on Mac, probably CTRL+Click?) > > > 2) How do I create a new snippet? > > There's no GUI for that yet. Maybe that will happen at some > point but right now it's all manual work. > > 1) Go to config directory (create if it does not exist) > > The folder name can be found in Help->Library Info->User > Config Path > > 2) Create a subfolder called "templates" > > 3) Create a text file with extension .json, for example: > > File name: points.json > Content: > { > "key" : "points", > "content" : "points = [ for (a = [0:5:359]) 1^~^ * [ -sin(x), cos(x) ] ]" > } > > The 3 chars ^~^ indicate where the cursor will end up > after the text was inserted at the current cursor location. > > > 3) How do I edit an existing snippet? > > Those are stored in the Application Bundle, so it might be > possible to edit those by "Show Package Content" and going > into the Contents/Resources/templates folder. I'm not sure > if that's a good option though. > > For reference the files shipped in the application are: > https://github.com/openscad/openscad/tree/master/templates > > ciao, > Torsten. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
BC
Bob Carlson
Mon, May 24, 2021 12:56 AM

Thanks. That should be documented somewhere.

I would suggest first of all, that all templates include vectors with numbers. This is much quicker in the long run. Even when typing I do that. I type translate([0, 0, 0]), then edit. For multmatrix I would make it multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]). That’s a good starting point for that function.

Second, perhaps this is already how it works, but allow templates in the library to replace the built in ones. It would make for less confusion.

Also, in the Mac editor UI, option-leftarrow should go left one word, but it does not. This is basic mac text editing. And option-rightarrow does the “right” thing.

-Bob
Tucson AZ

On May 22, 2021, at 17:45, Torsten Paul Torsten.Paul@gmx.de wrote:

On 18.05.21 03:14, rjcarlson49 wrote:

  1. The option key on the mac subs for alt, but where is the
    ins(ert?) key?

No idea where that key is on Mac, but the code snippets can
be also inserted via context menu (normally right click in
the editor, wherever that is on Mac, probably CTRL+Click?)

  1. How do I create a new snippet?

There's no GUI for that yet. Maybe that will happen at some
point but right now it's all manual work.

  1. Go to config directory (create if it does not exist)

The folder name can be found in Help->Library Info->User
Config Path

  1. Create a subfolder called "templates"

  2. Create a text file with extension .json, for example:

File name: points.json
Content:
{
"key" : "points",
"content" : "points = [ for (a = [0:5:359]) 1^~^ * [ -sin(x), cos(x) ] ]"
}

The 3 chars ^~^ indicate where the cursor will end up
after the text was inserted at the current cursor location.

  1. How do I edit an existing snippet?

Those are stored in the Application Bundle, so it might be
possible to edit those by "Show Package Content" and going
into the Contents/Resources/templates folder. I'm not sure
if that's a good option though.

For reference the files shipped in the application are:
https://github.com/openscad/openscad/tree/master/templates

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Thanks. That should be documented somewhere. I would suggest first of all, that all templates include vectors with numbers. This is much quicker in the long run. Even when typing I do that. I type translate([0, 0, 0]), then edit. For multmatrix I would make it multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]). That’s a good starting point for that function. Second, perhaps this is already how it works, but allow templates in the library to replace the built in ones. It would make for less confusion. Also, in the Mac editor UI, option-leftarrow should go left one word, but it does not. This is basic mac text editing. And option-rightarrow does the “right” thing. -Bob Tucson AZ On May 22, 2021, at 17:45, Torsten Paul <Torsten.Paul@gmx.de> wrote: On 18.05.21 03:14, rjcarlson49 wrote: > 1) The option key on the mac subs for alt, but where is the > ins(ert?) key? No idea where that key is on Mac, but the code snippets can be also inserted via context menu (normally right click in the editor, wherever that is on Mac, probably CTRL+Click?) > 2) How do I create a new snippet? There's no GUI for that yet. Maybe that will happen at some point but right now it's all manual work. 1) Go to config directory (create if it does not exist) The folder name can be found in Help->Library Info->User Config Path 2) Create a subfolder called "templates" 3) Create a text file with extension .json, for example: File name: points.json Content: { "key" : "points", "content" : "points = [ for (a = [0:5:359]) 1^~^ * [ -sin(x), cos(x) ] ]" } The 3 chars ^~^ indicate where the cursor will end up after the text was inserted at the current cursor location. > 3) How do I edit an existing snippet? Those are stored in the Application Bundle, so it might be possible to edit those by "Show Package Content" and going into the Contents/Resources/templates folder. I'm not sure if that's a good option though. For reference the files shipped in the application are: https://github.com/openscad/openscad/tree/master/templates ciao, Torsten. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org
M
MichaelAtOz
Mon, May 24, 2021 2:21 AM

rjcarlson49 wrote

Thanks. That should be documented somewhere.

The  OpenSCAD Manual Wiki
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual#The_OpenSCAD_User_Manual
is editable by anyone ;)
There doesn't seem to be a section this info would slot into, so if anyone
wants to add this info,
I'd do it in FAQ for now. There is a bunch of similar config details that
need documenting, color schemes, registry (and *nix equiv.) etc.

rjcarlson49 wrote

I would suggest first of all, that all templates include vectors with
numbers. This is much quicker in the long run. Even when typing I do that.
I type translate([0, 0, 0]), then edit. For multmatrix I would make it
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]). That’s a good
starting point for that function.

This is a very personal matter of taste, I would (and have in Notepad++) use
<KeyWord name="translate (["/>
So from there I just type e,g, "somevar.x, somevar.y, -1] ) " then follow on
e.g. "cu" for a cube.

rjcarlson49 wrote

Second, perhaps this is already how it works, but allow templates in the
library to replace the built in ones. It would make for less confusion.

+1, if it doesn't now, they are in the template subdir where the .exe lives
(e.g. 'My programs' for Windows).
rjcarlson49 wrote

Also, in the Mac editor UI, option-leftarrow should go left one word, but
it does not. This is basic mac text editing. And option-rightarrow does
the “right” thing.

Bob, would you be able to check the  Keyboard info on GitHub
https://github.com/openscad/openscad/wiki/Keyboard-Shortcuts  from a Mac
users perspective?
No need to edit it, just note anything here and I'll update it.


OpenSCAD Admin - email* me if you need anything,  or if I've done something stupid...

  • on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

--
Sent from: http://forum.openscad.org/

rjcarlson49 wrote > Thanks. That should be documented somewhere. The OpenSCAD Manual Wiki <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual#The_OpenSCAD_User_Manual> is editable by anyone ;) There doesn't seem to be a section this info would slot into, so if anyone wants to add this info, I'd do it in FAQ for now. There is a bunch of similar config details that need documenting, color schemes, registry (and *nix equiv.) etc. rjcarlson49 wrote > I would suggest first of all, that all templates include vectors with > numbers. This is much quicker in the long run. Even when typing I do that. > I type translate([0, 0, 0]), then edit. For multmatrix I would make it > multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]). That’s a good > starting point for that function. This is a very personal matter of taste, I would (and have in Notepad++) use <KeyWord name="translate (["/> So from there I just type e,g, "somevar.x, somevar.y, -1] ) " then follow on e.g. "cu" for a cube. rjcarlson49 wrote > Second, perhaps this is already how it works, but allow templates in the > library to replace the built in ones. It would make for less confusion. +1, if it doesn't now, they are in the template subdir where the .exe lives (e.g. 'My programs' for Windows). rjcarlson49 wrote > Also, in the Mac editor UI, option-leftarrow should go left one word, but > it does not. This is basic mac text editing. And option-rightarrow does > the “right” thing. Bob, would you be able to check the Keyboard info on GitHub <https://github.com/openscad/openscad/wiki/Keyboard-Shortcuts> from a Mac users perspective? No need to edit it, just note anything here and I'll update it. ----- OpenSCAD Admin - email* me if you need anything, or if I've done something stupid... * on the Forum, click on my MichaelAtOz label, there is a link to email me. Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. -- Sent from: http://forum.openscad.org/
BC
Bob Carlson
Mon, May 24, 2021 6:03 PM

I looked at it, but it will take some time to do it right.

First thing I noticed though is that on a Mac, there is a control key. ctrl should equal control not command. When the semantics exist on a mac like undo, cut, copy, paste the Mac shortcuts should always be used. So those four are command-z, -x, -c, -v, even though those use control- on the PC. Perhaps the problem is just the presentation. Better I think would be a table with rows consisting of <action> <pc shortcut> <mac shortcut> <linux shortcut>. Is there a Linux version?

Second, the entire "Mac only navigation shortcuts” should probably be eliminated. AFAIK these are in no way mac standard and no one would use them.

-Bob
Tucson AZ

rjcarlson49 wrote
Also, in the Mac editor UI, option-leftarrow should go left one word, but it does not. This is basic mac text editing. And option-rightarrow does the “right” thing.
Bob, would you be able to check the Keyboard info on GitHub https://github.com/openscad/openscad/wiki/Keyboard-Shortcuts from a Mac users perspective?
No need to edit it, just note anything here and I'll update it.

OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...

  • on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.

Sent from the OpenSCAD mailing list archive http://forum.openscad.org/ at Nabble.com.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I looked at it, but it will take some time to do it right. First thing I noticed though is that on a Mac, there is a control key. ctrl should equal control not command. When the semantics exist on a mac like undo, cut, copy, paste the Mac shortcuts should always be used. So those four are command-z, -x, -c, -v, even though those use control- on the PC. Perhaps the problem is just the presentation. Better I think would be a table with rows consisting of <action> <pc shortcut> <mac shortcut> <linux shortcut>. Is there a Linux version? Second, the entire "Mac only navigation shortcuts” should probably be eliminated. AFAIK these are in no way mac standard and no one would use them. -Bob Tucson AZ rjcarlson49 wrote Also, in the Mac editor UI, option-leftarrow should go left one word, but it does not. This is basic mac text editing. And option-rightarrow does the “right” thing. Bob, would you be able to check the Keyboard info on GitHub <https://github.com/openscad/openscad/wiki/Keyboard-Shortcuts> from a Mac users perspective? No need to edit it, just note anything here and I'll update it. OpenSCAD Admin - email* me if you need anything, or if I've done something stupid... * on the Forum, click on my MichaelAtOz label, there is a link to email me. Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> at Nabble.com. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org
M
MichaelAtOz
Tue, May 25, 2021 4:07 AM

Sorry Bob, I wrote the first bits, where I included this at the top,

'C - Ctrl (Cmd on Mac) '

'M - Ctrl on Mac (Windows/Meta key on others) '

I should have mentioned that.

I did that as the GitHub Wiki is written from a developer's perspective, and so in Qt context https://doc.qt.io/qt-5/qkeysequence.html#details , where:

'Each key code consists of a single Qt::Key https://doc.qt.io/qt-5/qt.html#Key-enum  value and zero or more modifiers, such as Qt::SHIFT https://doc.qt.io/qt-5/qt.html#Modifier-enum , Qt::CTRL https://doc.qt.io/qt-5/qt.html#Modifier-enum , Qt::ALT https://doc.qt.io/qt-5/qt.html#Modifier-enum  and Qt::META https://doc.qt.io/qt-5/qt.html#Modifier-enum .'

'On macOS, the appropriate symbols are used to describe keyboard shortcuts using special keys on the Macintosh keyboard.'

&

'Note: On macOS, references to "Ctrl", Qt::CTRL https://doc.qt.io/qt-5/qt.html#Modifier-enum , Qt::Key_Control https://doc.qt.io/qt-5/qt.html#Key-enum  and Qt::ControlModifier https://doc.qt.io/qt-5/qt.html#KeyboardModifier-enum  correspond to the Command keys on the Macintosh keyboard, and references to "Meta", Qt::META https://doc.qt.io/qt-5/qt.html#Modifier-enum , Qt::Key_Meta https://doc.qt.io/qt-5/qt.html#Key-enum  and Qt::MetaModifier https://doc.qt.io/qt-5/qt.html#KeyboardModifier-enum  correspond to the Control keys. Developers on macOS can use the same shortcut descriptions across all platforms, and their applications will automatically work as expected on macOS.'

So in Function Shortcuts

Key      Modifier          Function          Notes

...

C        C        Copy selection

V          C        Paste

X          C        Cut selection

Modifier 'C' means Command on Mac, but is technically in Qt  is CTRL, and 'M' Meta means Control on Mac. [I didn't write it]

In that context, I think the functions match.

Don't worry about it if you don't want to do that mental translation.

Re 'the entire "Mac only navigation shortcuts” should probably be eliminated. AFAIK these are in no way mac standard' they

are listed in https://support.apple.com/en-us/HT201236, is that out of date?

Michael.


From: Bob Carlson [mailto:bob@rjcarlson.com]
Sent: Tue, 25 May 2021 04:03
To: OpenSCAD general discussion
Subject: [OpenSCAD] Re: How do I edit/create code snippets?

I looked at it, but it will take some time to do it right.

First thing I noticed though is that on a Mac, there is a control key. ctrl should equal control not command. When the semantics exist on a mac like undo, cut, copy, paste the Mac shortcuts should always be used. So those four are command-z, -x, -c, -v, even though those use control- on the PC. Perhaps the problem is just the presentation. Better I think would be a table with rows consisting of <action> <pc shortcut> <mac shortcut> <linux shortcut>. Is there a Linux version?

Second, the entire "Mac only navigation shortcuts” should probably be eliminated. AFAIK these are in no way mac standard and no one would use them.

-Bob
Tucson AZ

rjcarlson49 wrote

Also, in the Mac editor UI, option-leftarrow should go left one word, but it does not. This is basic mac text editing. And option-rightarrow does the “right” thing.

Bob, would you be able to check the Keyboard info on GitHub https://github.com/openscad/openscad/wiki/Keyboard-Shortcuts  from a Mac users perspective?
No need to edit it, just note anything here and I'll update it.

OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...

  • on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


Sent from the OpenSCAD mailing http://forum.openscad.org/  list archive at Nabble.com.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

Sorry Bob, I wrote the first bits, where I included this at the top, 'C - Ctrl (Cmd on Mac) ' 'M - Ctrl on Mac (Windows/Meta key on others) ' I should have mentioned that. I did that as the GitHub Wiki is written from a developer's perspective, and so in Qt context <https://doc.qt.io/qt-5/qkeysequence.html#details> , where: 'Each key code consists of a single Qt::Key <https://doc.qt.io/qt-5/qt.html#Key-enum> value and zero or more modifiers, such as Qt::SHIFT <https://doc.qt.io/qt-5/qt.html#Modifier-enum> , Qt::CTRL <https://doc.qt.io/qt-5/qt.html#Modifier-enum> , Qt::ALT <https://doc.qt.io/qt-5/qt.html#Modifier-enum> and Qt::META <https://doc.qt.io/qt-5/qt.html#Modifier-enum> .' 'On macOS, the appropriate symbols are used to describe keyboard shortcuts using special keys on the Macintosh keyboard.' & 'Note: On macOS, references to "Ctrl", Qt::CTRL <https://doc.qt.io/qt-5/qt.html#Modifier-enum> , Qt::Key_Control <https://doc.qt.io/qt-5/qt.html#Key-enum> and Qt::ControlModifier <https://doc.qt.io/qt-5/qt.html#KeyboardModifier-enum> correspond to the Command keys on the Macintosh keyboard, and references to "Meta", Qt::META <https://doc.qt.io/qt-5/qt.html#Modifier-enum> , Qt::Key_Meta <https://doc.qt.io/qt-5/qt.html#Key-enum> and Qt::MetaModifier <https://doc.qt.io/qt-5/qt.html#KeyboardModifier-enum> correspond to the Control keys. Developers on macOS can use the same shortcut descriptions across all platforms, and their applications will automatically work as expected on macOS.' So in Function Shortcuts Key Modifier Function Notes ... C C Copy selection V C Paste X C Cut selection Modifier 'C' means Command on Mac, but is technically in Qt is CTRL, and 'M' Meta means Control on Mac. [I didn't write it] In that context, I think the functions match. Don't worry about it if you don't want to do that mental translation. Re 'the entire "Mac only navigation shortcuts” should probably be eliminated. AFAIK these are in no way mac standard' they are listed in https://support.apple.com/en-us/HT201236, is that out of date? Michael. _____ From: Bob Carlson [mailto:bob@rjcarlson.com] Sent: Tue, 25 May 2021 04:03 To: OpenSCAD general discussion Subject: [OpenSCAD] Re: How do I edit/create code snippets? I looked at it, but it will take some time to do it right. First thing I noticed though is that on a Mac, there is a control key. ctrl should equal control not command. When the semantics exist on a mac like undo, cut, copy, paste the Mac shortcuts should always be used. So those four are command-z, -x, -c, -v, even though those use control- on the PC. Perhaps the problem is just the presentation. Better I think would be a table with rows consisting of <action> <pc shortcut> <mac shortcut> <linux shortcut>. Is there a Linux version? Second, the entire "Mac only navigation shortcuts” should probably be eliminated. AFAIK these are in no way mac standard and no one would use them. -Bob Tucson AZ rjcarlson49 wrote Also, in the Mac editor UI, option-leftarrow should go left one word, but it does not. This is basic mac text editing. And option-rightarrow does the “right” thing. Bob, would you be able to check the Keyboard info on GitHub <https://github.com/openscad/openscad/wiki/Keyboard-Shortcuts> from a Mac users perspective? No need to edit it, just note anything here and I'll update it. OpenSCAD Admin - email* me if you need anything, or if I've done something stupid... * on the Forum, click on my MichaelAtOz label, there is a link to email me. Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. _____ Sent from the OpenSCAD mailing <http://forum.openscad.org/> list archive at Nabble.com. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
BC
Bob Carlson
Tue, Jun 8, 2021 1:35 AM

I have a bunch of templates set up now. They work fine. (For clarification, I’m talking MAC here.)

  1. I can’t set up a keyboard shortcut for Insert Template because that command does not exist in the menu tree. Apparently context menu items cannot be keyboard shortcutted. I verified this by tying the key to another command in the Edit menu and it works perfectly. Please just put Insert Template somewhere in the menu tree.

  2. It would be WAY easier to maintain if you allowed an array of templates in a single file instead of requiring a single file for each template.

  3. User templates do not replace the built in templates. Just the opposite. If I create a transfer template, it does not appear at all and the built in template is the only one available. I believe it would be better to reverse that.

  4. I notice that option-left and option-right now work. Maybe I was mistaken before. However, shift-option-left and shift-option-right are supposed to extend the selection one word to the left or right. That is NOT working.

  5. There was no OpenSCAD folder in …/Library/Application Support/. I had to create OpenSCAD/ and OpenSCAD/templates/.

-Bob
Tucson AZ

On May 22, 2021, at 17:45, Torsten Paul Torsten.Paul@gmx.de wrote:

On 18.05.21 03:14, rjcarlson49 wrote:

  1. The option key on the mac subs for alt, but where is the
    ins(ert?) key?

No idea where that key is on Mac, but the code snippets can
be also inserted via context menu (normally right click in
the editor, wherever that is on Mac, probably CTRL+Click?)

  1. How do I create a new snippet?

There's no GUI for that yet. Maybe that will happen at some
point but right now it's all manual work.

  1. Go to config directory (create if it does not exist)

The folder name can be found in Help->Library Info->User
Config Path

  1. Create a subfolder called "templates"

  2. Create a text file with extension .json, for example:

File name: points.json
Content:
{
"key" : "points",
"content" : "points = [ for (a = [0:5:359]) 1^~^ * [ -sin(x), cos(x) ] ]"
}

The 3 chars ^~^ indicate where the cursor will end up
after the text was inserted at the current cursor location.

  1. How do I edit an existing snippet?

Those are stored in the Application Bundle, so it might be
possible to edit those by "Show Package Content" and going
into the Contents/Resources/templates folder. I'm not sure
if that's a good option though.

For reference the files shipped in the application are:
https://github.com/openscad/openscad/tree/master/templates

ciao,
Torsten.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I have a bunch of templates set up now. They work fine. (For clarification, I’m talking MAC here.) 1) I can’t set up a keyboard shortcut for Insert Template because that command does not exist in the menu tree. Apparently context menu items cannot be keyboard shortcutted. I verified this by tying the key to another command in the Edit menu and it works perfectly. Please just put Insert Template somewhere in the menu tree. 2) It would be WAY easier to maintain if you allowed an array of templates in a single file instead of requiring a single file for each template. 3) User templates do not replace the built in templates. Just the opposite. If I create a transfer template, it does not appear at all and the built in template is the only one available. I believe it would be better to reverse that. 4) I notice that option-left and option-right now work. Maybe I was mistaken before. However, shift-option-left and shift-option-right are supposed to extend the selection one word to the left or right. That is NOT working. 5) There was no OpenSCAD folder in …/Library/Application Support/. I had to create OpenSCAD/ and OpenSCAD/templates/. -Bob Tucson AZ On May 22, 2021, at 17:45, Torsten Paul <Torsten.Paul@gmx.de> wrote: On 18.05.21 03:14, rjcarlson49 wrote: > 1) The option key on the mac subs for alt, but where is the > ins(ert?) key? No idea where that key is on Mac, but the code snippets can be also inserted via context menu (normally right click in the editor, wherever that is on Mac, probably CTRL+Click?) > 2) How do I create a new snippet? There's no GUI for that yet. Maybe that will happen at some point but right now it's all manual work. 1) Go to config directory (create if it does not exist) The folder name can be found in Help->Library Info->User Config Path 2) Create a subfolder called "templates" 3) Create a text file with extension .json, for example: File name: points.json Content: { "key" : "points", "content" : "points = [ for (a = [0:5:359]) 1^~^ * [ -sin(x), cos(x) ] ]" } The 3 chars ^~^ indicate where the cursor will end up after the text was inserted at the current cursor location. > 3) How do I edit an existing snippet? Those are stored in the Application Bundle, so it might be possible to edit those by "Show Package Content" and going into the Contents/Resources/templates folder. I'm not sure if that's a good option though. For reference the files shipped in the application are: https://github.com/openscad/openscad/tree/master/templates ciao, Torsten. _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org
KE
Karl Exler
Tue, Jun 8, 2021 8:26 AM

Dear friends

I found many libraries for modelling srews and bolts. As my requirements
are really very low and as I am not a screw specialist who is willing to
re-invent the circle Iḿ looking for a small library only for modelling
M2-M6 threads/bolts...

any recommendations?

BR
Karl

Dear friends I found many libraries for modelling srews and bolts. As my requirements are really very low and as I am not a screw specialist who is willing to re-invent the circle Iḿ looking for a small library only for modelling M2-M6 threads/bolts... any recommendations? BR Karl
NH
nop head
Tue, Jun 8, 2021 8:39 AM

Not really a small library but you can use a small part of it:
https://github.com/nophead/NopSCADlib#screws

[image: image.png]

On Tue, 8 Jun 2021 at 09:26, Karl Exler karl.exler@meinklang.cc wrote:

Dear friends

I found many libraries for modelling srews and bolts. As my requirements
are really very low and as I am not a screw specialist who is willing to
re-invent the circle Iḿ looking for a small library only for modelling
M2-M6 threads/bolts...

any recommendations?

BR
Karl


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Not really a small library but you can use a small part of it: https://github.com/nophead/NopSCADlib#screws [image: image.png] On Tue, 8 Jun 2021 at 09:26, Karl Exler <karl.exler@meinklang.cc> wrote: > Dear friends > > > I found many libraries for modelling srews and bolts. As my requirements > are really very low and as I am not a screw specialist who is willing to > re-invent the circle Iḿ looking for a small library only for modelling > M2-M6 threads/bolts... > > any recommendations? > > BR > Karl > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >