Open a blank schematic, add several text frames, and save the modified
.SchDoc.
This example is the text-frame companion to schdoc_add_note. It shows the
canonical public create-then-insert path for the standalone text-frame object:
- load an existing
SchDoc - describe absolute frame rectangles in mils
- call
make_sch_text_frame(...) - insert each object with
AltiumSchDoc.add_object(...) - persist the change with
AltiumSchDoc.save(...)
- creating detached text frames with
make_sch_text_frame(...) - using
SchRectMilsfor absolute placement - using
SchFontSpecinstead of rawfont_id - using
SchHorizontalAligninstead of raw alignment integers - using
LineWidthfor border thickness - using
ColorValuehelpers instead of raw Win32 color integers - reopening the written file and inspecting the created text frames
From the project root:
uv run python examples\schdoc_add_text_frame\schdoc_add_text_frame.pyThis sample uses:
examples/schdoc_add_text_frame/input/blank.SchDoc
The script writes:
examples/schdoc_add_text_frame/output/blank_with_text_frames.SchDoc
The output file should contain three visible text frames:
- left aligned,
LineWidth.SMALL,Arial 10 - center aligned,
LineWidth.MEDIUM,Courier New 12 - right aligned,
LineWidth.LARGE,Times New Roman 14
Each frame uses a different absolute rectangle so it is easy to verify the placement visually in Altium. The script also prints the reopened frame count, alignment, line width, font, and bounds for a quick terminal sanity check.