| 20 | | |
| 21 | | On 7/7/25 12:39, Elaine Meng wrote: |
| 22 | | > |
| 23 | | > |
| 24 | | > |
| 25 | | > |
| 26 | | > |
| 27 | | > |
| 28 | | > |
| 29 | | > |
| 30 | | > |
| 31 | | > |
| 32 | | > |
| 33 | | >> On Jul 7, 2025, at 12:18\u202fPM, Elaine Meng <meng@cgl.ucsf.edu> wrote: |
| 34 | | >> |
| 35 | | >> I know they are optional, obviously. I still don't understand, however, since my example works fine, i.e. I tested all of the commands exactly as shown. Did you try it? What about the example is wrong? |
| 36 | | >> |
| 37 | | >>>> https://www.cgl.ucsf.edu/home/meng/chimerax/vdocs/user/commands/alias.html#optional |
| 38 | | >> Or maybe you meant my example is right, but my explanation is incomplete? In the example, both $2 and $3 are indeed optional, and $2 can be given without $3, but $3 can't be given without $2. Your modified example seems less useful since if I understand it correctly, you couldn't give $2 without $3. |
| 39 | | >> |
| 40 | | >> But maybe you didn't mean it as a practical example of what the person would want to do, but a further illustration of how this stuff works. Sorry for being dense... |
| 41 | | >> |
| 42 | | >> Elaine |
| 43 | | >> |
| 44 | | >> |
| 45 | | >>> On Jul 7, 2025, at 11:00\u202fAM, Greg Couch <gregc@cgl.ucsf.edu> wrote: |
| 46 | | >>> |
| 47 | | >>> Close. The $[stuff$] are optional sections/expansions of the alias. They are included the alias expansion only if all of the $n arguments inside the optional section are present. |
| 48 | | >>> |
| 49 | | >>> Changing your example a little: |
| 50 | | >>> |
| 51 | | >>> alias myzone zone clear; zone $1 $[residueDistance $2 label $3$] |
| 52 | | >>> |
| 53 | | >>> would require that both $2 and $3 be given for the optional section to be expanded. |
| 54 | | >>> |
| 55 | | >>> To figure out which $n arguments to present as optional in the usage of the alias, the highest numbered $n argument that is outside of the optional sections is considered to be the last required argument. |
| 56 | | >>> |
| 57 | | >>> -- Greg |
| 58 | | >>> |
| 59 | | >>> On 7/7/2025 10:44 AM, Elaine Meng wrote: |
| 60 | | >>>> Hi Greg, |
| 61 | | >>>> does this explanation of the optional arguments seem OK? |
| 62 | | >>>> |
| 63 | | >>>> <https://www.cgl.ucsf.edu/home/meng/chimerax/vdocs/user/commands/alias.html#optional> |
| 64 | | >>>> |
| 65 | | >>>> I didn't understand this sentence in your presentation slides |
| 66 | | >>>> \u2022 an optional part is only included if all of the alias arguments referenced are given |
| 67 | | >>>> |
| 68 | | >>>> ... but maybe the last part of the example I put in the documentation (link above) covers it... |
| 69 | | >>>> Thanks, |
| 70 | | >>>> Elaine |
| 71 | | > |
| 72 | | }}} |