Skip to content

pydim.get_text

fabian-flassig edited this page Aug 25, 2026 · 1 revision

Reads the content, the placement and the appearance of a 2d annotation text.

pydim.get_text(text)
Parameter Type Description
text element_handle An element handle of type "text", e.g. from pydim.create_text.

Return value

Type Description
table A table describing the text:
Key Type Description
text string The text content.
view string The view the text is displayed in. Absent for views the Lua API does not expose (perspective).
orientation string The point of the text box that sits on the text position, see pydim.create_text.
angle number Rotation of the text in degrees.
position {x,y} Position of the text in the plane of the view, in object units. For an anchored text this is the offset from its anchor point, not an absolute position.
attached_to element_handle The part the text is anchored to and follows. Absent for a free text.
leader_count number Number of leaders attached to the text.
style {...} The appearance: size, aspect_ratio, width, font, pen, layer, bold, italic, underline and in_object_units, with the meaning described in pydim.create_text.

Example:

local t = pydim.create_text("12", {{600, 400, 0}}, {view = "xy", leader = true})

local info = pydim.get_text(t)
pyui.alert(string.format("%s in %s, %d leader(s), height %g",
                         info.text, info.view, info.leader_count, info.style.size))

if info.attached_to then
    pyui.alert("follows part " .. tostring(info.attached_to:get_element_type()))
end

Remarks:

  • position and style.size / style.width are in the unit style.in_object_units selects.
  • leader_count may be greater than 1: Lua creates at most one leader per text, but further leaders can be added interactively with Text -> Leader at text.

Version Support:

Minimum PYTHA Version: V27

See also:

pydim, pydim.create_text, pydim.update_text, element handles

Clone this wiki locally