Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Functions for Creation of Texts

  • Last UpdatedJan 07, 2026
  • 1 minute read

This section describes functions to create text entities (elements) in the current drawing. Each function returns a handle to the created entity, used for identification in subsequent processing of the entity (for example, the delete function).

Multiple line texts are handled. The character '\n' is used as separator between two lines.

text_length(Text)

The function calculate the text length in specified font format.

Input Parameters:

Text

KcsText.Text

The text definition.

None.

Returned value:

[0]

float

The length of the text.

Exceptions:

kcs_ArgumentError

Invalid argument.

text_new(String, Pos)

text_new(Text)

The function creates a text, with modal attributes, in the current drawing.

Input Parameters:

String

String

Element handle.

Pos

Point2D

Position of the text.

Text

KcsText

Instance of KcsText.Text class.

Returned value:

[0]

Integer

Handle to the created text

Exceptions:

kcs_ValueError

Invalid parameter value.

kcs_DrawingNotCurrent

No drawing was current

kcs_Error

General error.

kcs_PythonLibraryNotFound

Program can't find python library.

kcs_PythonMethodNotFound

Python module error.

rule_text_new(Text, RuleNo)

The function creates a text according to a given rule number, in the drawing form of the current drawing. If such a text already exists, it will be replaced.

Input Parameters:

Text

string

The text value (maximum 512 characters)

RuleNo

integer

The rule number

Returned value:

[0]

integer

Handle to the created text

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_NoFormInDrawing

The drawing contains no form

kcs_RuleNoInvalid

Invalid rule (not found in form)

kcs_FormNotFound

The drawing form was not found in the data bank

Example:

# Example: kcs_ex_draft11.py

# Example: kcs_ex_draft24.py

# Example: kcs_ex_draft25.py

Related Links
TitleResults for “How to create a CRG?”Also Available in