I have been trying to 3d print braille, hence looking for a way where Rhino could identify the letters and change them its respective braille letter cylinders (https://en.wikipedia.org/wiki/Braille_ASCII#Braille_ASCII_values) with 4mm height.
Can someone help? It might need python scripting as well, I am not sure.
Hey Laurent thanks for the reply!
Looks perfect, but here’s my problem-
I want it to identify all the text from the drawing itself and replace it with Braille automatically . The image you shared is when you feed text into grasshopper, and it gives you a braille output. I guess I wasn’t clear about it I am sorry.
Hello
no problem, but is it text or surface or whatever. If it is text you surely could implement the same logic. Have you some 3dm for example ?
I will put my script (corrected) in the above answer.
And also put a category to the discussion, Rhino, Rhino developper, grasshopper …
You can consider text in this case, ignoring surfaces. Here’s and example of a file with actual texts, that needs to be converted to Braille- map text.3dm (35.8 KB)
Not a bad idea. But it needs selecting each font and going to properties, changing font style, exploding them to get curves, surfacing them and extruding to get cylinders. A better way?
or just type the words in that font using text object with solid option.
also you don’t need to “surface them”. just extrude the curves once you had turn them into braile font, is not a big deal,
select all.
change the font
explode
extrude
done
Thanks for the suggestion! Infact, text object has an option to provide height as well! It is good when we are making a new file and typing all the text. However, I am looking for something where the texts already exists in the file, and I can convert them directly to Braille
Then slect in Rhino, click enter if OK.
Surface will appears, you can extrude then,…
When OK you could bake the geometry in Rhino. braille from textobject.gh (5.4 KB)
//Rhino.DocObjects.TextObject obj = (Rhino.DocObjects.TextObject) RhinoDocument.Objects.FindId(guid);
var objet = RhinoDocument.Objects.FindId(guid);
//Data from wikipedia
string ascii = " A1B'K2L@CIF/MSP\"E3H9O6R^DJG>NTQ,*5<-U8V.%[$+X!&;:4\\0Z7(_?W]#Y)=";
var charsAscii = ascii.ToCharArray();
string braille = "⠀⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿";
var charsBraille = braille.ToCharArray();
if(objet is Rhino.DocObjects.TextObject)
{
Rhino.DocObjects.TextObject obj = ( Rhino.DocObjects.TextObject) objet;
//get the text of text object
string brailleString = obj.DisplayText.ToUpper();
//Conversion to Braille
for (int i = 0; i < charsAscii.Length; i++)
{
brailleString = brailleString.Replace(charsAscii[i], charsBraille[i]);
}
//To surface
if(size == 0) size = 5;
Rhino.DocObjects.Font.FontStyle fontStyle = Rhino.DocObjects.Font.FontStyle.Upright;
Rhino.DocObjects.Font.FontWeight fontWeight = Rhino.DocObjects.Font.FontWeight.Normal;
bool underlined = false;
bool strikethrough = false;
Rhino.DocObjects.Font font = new Rhino.DocObjects.Font(face, fontWeight, fontStyle, underlined, strikethrough);
BoundingBox bb = obj.Geometry.GetBoundingBox(false);
Plane plane = new Plane(bb.Min + Vector3d.YAxis * size, Vector3d.XAxis, Vector3d.YAxis);
TextEntity text_entity = new TextEntity
{
Plane = plane,
PlainText = brailleString,
Justification = TextJustification.BottomRight,
Font = font
};
Rhino.DocObjects.DimensionStyle dimstyle = new Rhino.DocObjects.DimensionStyle();
dimstyle.TextHeight = size;
double smallCapsScale = 1;
double spacing = 0;
A = text_entity.CreateSurfaces(dimstyle, smallCapsScale, spacing);
}
This is exaclty what I was looking for! Thanks a ton Laurent! Diesgo’s method works but not when you want to go a step further and assign your own symbols and custom shapes