# Apply Morse Code onto a Curve

**URL:** <https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387>\
**Category:** Grasshopper\
**Tags:** data-tree\
**Created:** [June 3, 2020, 1:41pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387 "2020-06-03T13:41:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajmal.majeed.v](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ajmal.majeed.v/32/585159_2.png) [@ajmal.majeed.v](https://discourse.mcneel.com/u/ajmal.majeed.v)\
**Post date:** [June 3, 2020, 1:41pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/1 "2020-06-03T13:41:09Z")

</div>

Hey guys,  
I’m trying to script a sentence in morse code. The output I want is a line segment in dash and dots following the rules of Morse code.

- The length of a dot is 1 time unit.
- A dash is 3 time units.
- The space between symbols (dots and dashes) of the same letter is 1 time unit.
- The space between letters is 3 time units.
- The space between words is 7 time units.

Basically, I want to apply this to a curve and obtain the curve segmented according to morse code.

For example,

‘the quick brown fox’ in morse code is " - … . --.- ..- .. -.-. -.- -… .-. — .-- -. ..-. — -..-"

I want to apply this to a curve and get this in segments.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/6/4/64f7221fc1934f98aa84080c593ea594eb9fbe9b.jpeg)

I hope I have explained the problem. I know it’s a bit geeky, But anyone with suggestions to resolve this would be great.

Thanks,  
AM

---

<div class="post-metadata">

**Author:** ![maje90](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maje90/32/771922_2.png) [@maje90](https://discourse.mcneel.com/u/maje90)\
**Post date:** [June 3, 2020, 2:41pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/3 "2020-06-03T14:41:03Z")

</div>

> [@ajmal.majeed.v](#):
>
> it’s a bit geeky

🤣 you said it!

The idea is to have a sequence of numbers defining the length of “on” and “off” state.  
Make mass addiction \> partial results and then evaluate length to get parameters, and shatter with those parameters. Then doing a dispatch will let you keep/see only the “on” state.  
This part is actually the simplest, just 4 components.

To achieve your sequence of numbers you can smartly insert characters and then “translate” them using unicode.

Reverse-engineering this will explain more than words.

 ![2020-06-03 16_36_38-Grasshopper - morse_](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/6/d/6dd8022e54e022a004d289fd8ccb353b182caf15.png)  
[morse-code to curve.gh](https://discourse.mcneel.com/uploads/short-url/8OpT8a77Z5qXm2BAv5OdUcg2C33.gh) (24.5 KB)

---

<div class="post-metadata">

**Author:** ![akilli](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/akilli/32/514967_2.png) [@akilli](https://discourse.mcneel.com/u/akilli)\
**Post date:** [June 3, 2020, 3:03pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/4 "2020-06-03T15:03:49Z")

</div>

Where did you get your Morse Code table?

---

<div class="post-metadata">

**Author:** ![maje90](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maje90/32/771922_2.png) [@maje90](https://discourse.mcneel.com/u/maje90)\
**Post date:** [June 3, 2020, 3:11pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/5 "2020-06-03T15:11:04Z")

</div>

Here [https://morsecode.world/international/morse2.html](https://morsecode.world/international/morse2.html)  
I searched for the easiest to copy-paste.  
There are errors?

PS1 i wrote brown as BOWN …  
PS2 the space character, i’ve translated to ‘\_’ but it could have just been translated into itself in the first translation, making it " = " in the first dictionary and " =7" in the second dictionary…

---

<div class="post-metadata">

**Author:** ![akilli](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/akilli/32/514967_2.png) [@akilli](https://discourse.mcneel.com/u/akilli)\
**Post date:** [June 3, 2020, 3:14pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/6 "2020-06-03T15:14:58Z")

</div>

I wasn’t checking you, I was just wondering how you got it into such a nice GH format.

---

<div class="post-metadata">

**Author:** ![maje90](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maje90/32/771922_2.png) [@maje90](https://discourse.mcneel.com/u/maje90)\
**Post date:** [June 3, 2020, 3:20pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/7 "2020-06-03T15:20:58Z")

</div>

Yes, many morse code tables are shown in 2 or more columns and selecting them mess up the order.  
In that page the `<div>`s are probably in an order which made the selecting easy.  
Then removing the spaces with notepad++ is a 30 sec task, using ALT+drag to edit many rows at once:  
 ![n++](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/c/e/ce368a7f43a080a242e9c532a12663e639ff88d6.gif)  
(I’m saying this just for who don’t know this 🙃 … notepad++ should be built-in on windows!)

---

<div class="post-metadata">

**Author:** ![ajmal.majeed.v](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ajmal.majeed.v/32/585159_2.png) [@ajmal.majeed.v](https://discourse.mcneel.com/u/ajmal.majeed.v)\
**Post date:** [June 3, 2020, 7:01pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/8 "2020-06-03T19:01:02Z")

</div>

Riccardo, You Rockstar!  
It’s just perfectly what I wanted.  
Reverse-engineering it makes sense of the logic.

I can now complete my tattoo!

Thanks buddy!

---

<div class="post-metadata">

**Author:** ![maje90](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maje90/32/771922_2.png) [@maje90](https://discourse.mcneel.com/u/maje90)\
**Post date:** [June 3, 2020, 7:17pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/9 "2020-06-03T19:17:25Z")

</div>

> [@ajmal.majeed.v](#):
>
> tattoo

whoa!  
Please double… **triple** check if the dictionary i’ve used is correct! (I’ve just copy-pasted from a random google result).  
Check that everything is correct and translate back to counter proof the correct-ness of everything.

---

<div class="post-metadata">

**Author:** ![ajmal.majeed.v](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ajmal.majeed.v/32/585159_2.png) [@ajmal.majeed.v](https://discourse.mcneel.com/u/ajmal.majeed.v)\
**Post date:** [June 3, 2020, 9:13pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/10 "2020-06-03T21:13:12Z")

</div>

Absolutely, I cross-checked already.

Will do multiple proof reading before inking!

Thanks anyways, Appreciate it!

---

<div class="post-metadata">

**Author:** ![akilli](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/akilli/32/514967_2.png) [@akilli](https://discourse.mcneel.com/u/akilli)\
**Post date:** [June 3, 2020, 10:09pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/11 "2020-06-03T22:09:28Z")

</div>

Just as an aside, there’s a great book “The Victorian Internet” by Tom Standage that makes the case the telegraph was a more world-shaking development than the WWW. I tend to agree.

[https://www.amazon.com/Victorian-Internet-Remarkable-Nineteenth-line/dp/162040592X](https://www.amazon.com/Victorian-Internet-Remarkable-Nineteenth-line/dp/162040592X)

---

<div class="post-metadata">

**Author:** ![Matt\_Harwood](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/matt_harwood/32/620591_2.png) [@Matt\_Harwood](https://discourse.mcneel.com/u/Matt_Harwood)\
**Post date:** [June 4, 2020, 12:34pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/12 "2020-06-04T12:34:58Z")

</div>

This sounded like a fun little problem, so I gave it a go in Python:

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/a/8/a8acb655a866ac0ef1816c6bbd38cd74325bdc8a.png)

Thanks for the inspiration!

[Morse Code Curve.gh](https://discourse.mcneel.com/uploads/short-url/v0swcIdOhlL1XyS0dcU7OQYl9dM.gh) (11.8 KB) [MorseCodeDict.txt](https://discourse.mcneel.com/uploads/short-url/qAhUGhHUkC4tkiRvXuSBhUiGkBS.txt) (184 Bytes)

---

<div class="post-metadata">

**Author:** ![Volker\_Rakow](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/volker_rakow/32/770451_2.png) [@Volker\_Rakow](https://discourse.mcneel.com/u/Volker_Rakow)\
**Post date:** [July 19, 2026, 10:40pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/14 "2026-07-19T22:40:56Z")

</div>

Did Key/Value Search and Dash Pattern not exist back then?:

 ![high res test](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/8/6/d86e6d0770e1cc32576e7dda486a986480a10f58.png)  
[Apply Morse Code onto a Curve VR 1.gh](https://discourse.mcneel.com/uploads/short-url/nPEPjSK0m9rXG6mL7DP4GYVGQ4E.gh) (16.1 KB)

---

<div class="post-metadata">

**Author:** ![Volker\_Rakow](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/volker_rakow/32/770451_2.png) [@Volker\_Rakow](https://discourse.mcneel.com/u/Volker_Rakow)\
**Post date:** [July 20, 2026, 5:49am UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/15 "2026-07-20T05:49:53Z")

</div>

How to do this when the dashed line is given thickness to be turned to circles and obrounds?

I thought about using Flow from a line to the curve, but that would disfigure the circles into non-circles which doesn’t look so clean.

---

<div class="post-metadata">

**Author:** ![maje90](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maje90/32/771922_2.png) [@maje90](https://discourse.mcneel.com/u/maje90)\
**Post date:** [July 20, 2026, 12:30pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/16 "2026-07-20T12:30:55Z")

</div>

> [@Volker\_Rakow](#):
>
> Did Key/Value Search and Dash Pattern not exist back then?

no idea about 6 years ago, but most likely yes, it’s just I did not know all grasshopper components.  
And… I still discover new commands in Rhino and new components in Grasshopper…

* * *

> [@Volker\_Rakow](#):
>
> How to do this when the dashed line is given thickness to be turned to circles and obrounds?

… can we say dots (circles) radius is equal to half-width of the strokes?  
If so, dispatch your dot and dashes:

- for dots, create a circle from the center of the dot line segment
- for dashes, shrink the segment ends by radius (negative extend) and then make both-sides offset and cap with half-circle arcs

 ![2026-07-20 14_28_04-Untitled - Rhino 7 Commercial - Top](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/b/f/9bf85be8b36f0dededf1af9d1a54535519e8eb66.png)

---

<div class="post-metadata">

**Author:** ![Volker\_Rakow](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/volker_rakow/32/770451_2.png) [@Volker\_Rakow](https://discourse.mcneel.com/u/Volker_Rakow)\
**Post date:** [July 20, 2026, 2:33pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/17 "2026-07-20T14:33:48Z")

</div>

> [@maje90](#):
>
> … can we say dots (circles) radius is equal to half-width of the strokes?

Yes… but no? If the dots are circles, the radius must be both the half-length of the dot in the chain and the half-width of the stroke. So either the base width unit for the dots/dashes and the spaces inbetween them are decided with the stroke size resultant, or you pick a stroke size and it determines the domain of the target curve used to show the Morse code.

> [@maje90](#):
>
> If so, dispatch your dot and dashes:
> 
> - for dots, create a circle from the center of the dot line segment
> - for dashes, shrink the segment ends by radius (negative extend) and then make both-sides offset and cap with half-circle arcs
> 
> ![2026-07-20 14_28_04-Untitled - Rhino 7 Commercial - Top](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/b/f/9bf85be8b36f0dededf1af9d1a54535519e8eb66.png)

This is a passable solution. It will result in variable spacing between the dots and dashes. I am reminded of [this](https://discourse.mcneel.com/t/curved-glass-facade-regular-ribbon-shape/219244) thread, where Divide Distance with semi-circles was discussed, and am considering appoaching this problem as pearls on a thread?

---

<div class="post-metadata">

**Author:** ![maje90](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maje90/32/771922_2.png) [@maje90](https://discourse.mcneel.com/u/maje90)\
**Post date:** [July 20, 2026, 7:12pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/18 "2026-07-20T19:12:51Z")

</div>

Ok, so help me understand it fully:

- circles for dots, ok
- space a dot/dash to another dot/dash have to be exactly the same as a dot/circle diameter, right?
- about dashes, do the have to be straight lines, or curved as the original path?
- again about dashes, do they have to be measured internally by length or by 2 chords? (like two dots pattern)

---

<div class="post-metadata">

**Author:** ![Volker\_Rakow](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/volker_rakow/32/770451_2.png) [@Volker\_Rakow](https://discourse.mcneel.com/u/Volker_Rakow)\
**Post date:** [July 20, 2026, 7:33pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/19 "2026-07-20T19:33:28Z")

</div>

What happened to the solution? 😮

---

<div class="post-metadata">

**Author:** ![maje90](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maje90/32/771922_2.png) [@maje90](https://discourse.mcneel.com/u/maje90)\
**Post date:** [July 20, 2026, 7:35pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/20 "2026-07-20T19:35:21Z")

</div>

My previous comment was wrong, I edited it.  
2 circles in a high curvature path can result to look like too close each-other. You are right, to solve this you might want to solve this with a chord-based solution.  
See my questions above in the edited comment.

---

<div class="post-metadata">

**Author:** ![Volker\_Rakow](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/volker_rakow/32/770451_2.png) [@Volker\_Rakow](https://discourse.mcneel.com/u/Volker_Rakow)\
**Post date:** [July 20, 2026, 7:44pm UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/21 "2026-07-20T19:44:35Z")

</div>

> [@maje90](#):
>
> - circles for dots, ok
> - space a dot/dash to another dot/dash have to be exactly the same as a dot/circle diameter, right?

Yes.

> [@maje90](#):
>
> - about dashes, do the have to be straight lines, or curved as the original path?

No, they do not have to be lines, or rather they shouldn’t be lines.

> [@maje90](#):
>
> - again about dashes, do the have to be measured internally by length or by 2 chords? (like two dots pattern)

Well, it’s three, but yes, I imagined measuring internally by 3 chords.

~~So, basically, you find the total number of chord units, use [Daniel’s Kangaroo method](https://discourse.mcneel.com/t/divide-curve-by-equal-distance/73971/7) to spread these chords evenly across the curve. Center points on the chords for circles. Cull circles that are gaps. Somehow merge three circles into a deformed oblong… This is also just an appoximation then though as centerpoint(s) of the figures do not lie on the curve anymore.~~ **This doesn’t work.**

@laurent_delrieu 's Nautilus has a String of Pearls component, but it doesn’t scale the pearls to the length of the curve:

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/f/2/2f2016aa2df810a6cd913009abaf768f6820c4c7.png)

Mainly, it bothered me that the circles were being deformed to not-circles via Flow

---

<div class="post-metadata">

**Author:** ![Volker\_Rakow](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/volker_rakow/32/770451_2.png) [@Volker\_Rakow](https://discourse.mcneel.com/u/Volker_Rakow)\
**Post date:** [July 21, 2026, 1:30am UTC](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387/22 "2026-07-21T01:30:37Z")

</div>

This is what I have so far using String of Pearls,:

 ![high res test](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/e/e/4/ee49cce1ebec0e8a163e582e1f3a617e47eda001.png)  
[Apply Morse Code onto a Curve VR 3.gh](https://discourse.mcneel.com/uploads/short-url/nrYUbyfpH4H2YIsTiCWIi3CIDQW.gh) (39.6 KB)

but like I say, I do not how to scale the dots and dashes to the curve length, or the curve length to the dots and dashes. Galapagos?

[Next page](https://discourse.mcneel.com/t/apply-morse-code-onto-a-curve/103387.md?page=2)
