Center Textentity

Hi,

Is it possible to center a textentity?
I can’t set align anywhere and getboudingbox does only return the align point…

Thank you.

Jordy

Center on what? I think I need more information. :wink:

– D

Hi Jordy,

Not sure if this helps but I found in python it can be done like so:

import rhinoscriptsyntax as rs
import scriptcontext
import Rhino


obj = rs.SelectedObjects()[0]
rhobj = rs.coerceguid(obj)
rhgeom = rs.coercegeometry(obj)

rhgeom.Justification = Rhino.Geometry.TextJustification.MiddleCenter

scriptcontext.doc.Objects.Replace(rhobj,rhgeom)

http://4.rhino3d.com/5/rhinocommon/?topic=html/P_Rhino_Geometry_TextEntity_Justification.htm

HTH
-Willem

@Willem Exactly what I was looking for.
Just couldnt find the Allign part anywhere. Thought it would be under rhgeom.allign or something.

Thank you.

@dale What I have is a rectangle and the text needs to be in the center-center of this rectangle. I was able to center-center the reference point of the textentity but could not change the allignment of it.

Here is (another) sample if anyone is interested.

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsText.cs