Hi,
Is it possible to write a script in GHPython to create a text object and in the output represent both text and mesh object which could be defined colored mesh?
If someone knows that and how to write. I’ll appreciate the help.
Hi,
Is it possible to write a script in GHPython to create a text object and in the output represent both text and mesh object which could be defined colored mesh?
If someone knows that and how to write. I’ll appreciate the help.
Hello again, sorry for insisting on.
I’m grateful If someone could share an idea or any suggestion about my issue in helping me.
Could you be a little more clear for the input and output
Input
Text
Font
Size …
Thickness?
Output
Mesh (2d 3d ?)
you will find script that can do that if you search on old forum grasshopper3d.com
Hi @laurent_delrieu.
Sure, Thanks for the reply.
here’s my plan for the script:
Inputs:
Outputs:
Thank you.
Here is a small script. There are 2 C#, one ouputting all fonts (424 for me) and one outputing Brep. Brep are changed to mesh outside C#. It is surely not difficult to do it inside, so you can do it.
There is no placement of the text.
I am quite sure many plugins do this type of work but it was interesting to remake this script with the new Rhino 6 objects.
And for the record
https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_Font.htm
https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Geometry_TextEntity.htm
if(content != null && content != String.Empty
&& face != null && face != String.Empty )
{
if(size == 0)
size = 5;
Rhino.DocObjects.Font.FontStyle fontStyle = Rhino.DocObjects.Font.FontStyle.Upright;
if (italics) fontStyle = Rhino.DocObjects.Font.FontStyle.Italic;
Rhino.DocObjects.Font.FontWeight fontWeight = Rhino.DocObjects.Font.FontWeight.Normal;
if (bold) fontWeight = Rhino.DocObjects.Font.FontWeight.Bold;
bool underlined = false;
bool strikethrough = false;
Rhino.DocObjects.Font font = new Rhino.DocObjects.Font(face, fontWeight, fontStyle, underlined, strikethrough);
TextEntity text_entity = new TextEntity
{
Plane = Plane.WorldXY,
PlainText = content,
Justification = TextJustification.MiddleCenter,
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);
}
else
{
Print("Some content is required.");
}
And see this
@laurent_delrieu wonderful!
Thank you so much. for your help.
best
Hi Laurent,
My old vector text tool which woked in Rhino 5 had a plane input, but it does not work in Rhino 6.
Is it possibble that you can add it to your text tool too?
Thank you very much for this program Laurent, it helped me enormously for a project.
On the other hand, do you know if it is possible to recover the curves of a monoline font like SLF ARCHITECT. This would be for the 2nd part of my project but I have no idea how to do it.
Can you help me with this?
Hello
happy it helped.
You will find in my plugin this kind of tool. It is also quite easy to use Rhino common for that.
Many thanks Laurent !