-
Notifications
You must be signed in to change notification settings - Fork 18
pydim.update_text
fabian-flassig edited this page Aug 25, 2026
·
1 revision
Changes the content, the placement or the appearance of an existing 2d annotation text.
Similar to the Text -> Correct function in the PYTHA user interface.
pydim.update_text(text, changes)| Parameter | Type | Description |
|---|---|---|
text |
element_handle |
An element handle of type "text". |
changes |
{...} |
The fields to change. Every field the table does not mention keeps its current value. |
changes.text |
string |
The new text content. |
changes.angle |
number |
Rotation of the text in degrees. |
changes.orientation |
string |
The point of the text box that sits on the text position, see pydim.create_text. |
changes.position |
{x,y} |
Position of the text in the plane of the view, in object units — the value pydim.get_text reports, not an offset from the anchor. |
changes.leader |
boolean or {...}
|
false deletes every leader of the text. A table applies its values (pen, line_type, flag_length, arrow_length) to the existing leaders. |
changes.style |
{...} |
The appearance, with the same keys as in pydim.create_text. |
| Type | Description |
|---|---|
boolean |
true if the text was changed, false if it sits on a locked layer — in that case nothing is changed. |
local t = pydim.create_text("12", {{600, 400, 0}}, {view = "xy", leader = true})
-- renumber and emphasise
pydim.update_text(t, {text = "13", style = {bold = true, pen = 2}})
-- thinner leader
pydim.update_text(t, {leader = {pen = 3, arrow_length = 2}})
-- drop the leader
pydim.update_text(t, {leader = false})- The view of a text cannot be changed; create a new text instead.
-
update_textcannot create a leader — a leader needs an arrow tip, which is whatpydim.create_textprovides. A leader table on a text without leaders does nothing. - Changing
changes.textrecalculates the width of the text box, unless the text has a fixed width orchanges.style.widthis given. - Changing
style.in_object_unitschanges the unitsize,widthandpositionare interpreted in, but does not convert the stored values.
Minimum PYTHA Version: V27
pydim, pydim.create_text, pydim.get_text, pydim.delete_text, element handles