Class Reference project

Manager for layout and schematic windows and its linkage. More...

Member

layout* currentLayout()
schematic* currentSchematic()
textEdit* currentTextEditor()
void closeLayout(layout *l)
void closeLayout3d(layout3d *l)
void closeSchematic(schematic *s)
bool defaultGui
textEdit * getCentralTextEditor()
layout* getLayout(schematic *s)
layout3d* getLayout3d(layout *l)
textEdit* getOpenTextEditor()
schematic* getSchematic(layout *lay)
bool hasSchematic(layout *lay)
int lastReportRang()
string lastReportText()
layout* newLayout()
layout* newSchematic()
void updateMacros()

Detailed Description

graph LR classDef thisClas fill:#eaf5fc,stroke:#3c7faa,stroke-width:4px; classDef clas fill:#eaf5fc,stroke:#3c7faa,stroke-width:1px; pr(project)--currentLayout-->la(layout) pr--currentSchematic-->sc(schematic) pr--getLayout3d-->l3(layout3d) pr--getCentralTextEditor-->te(textEdit) click pr "/layoutscript/api/project" click la "/layoutscript/api/layout" click sc "/layoutscript/api/schematic" click l3 "/layoutscript/api/layout3d" click te "/layoutscript/api/textedit" class pr thisClas class la,sc,l3,te clas

project is a static manager for editor windows. It creates layout, schematic, 3d and text windows and can link a layout to a schematic for schematic-driven layout. In a C++ macro started from a layout, layout is already the current window; project::currentLayout() returns that same pointer. In in-process Python there is no global layout, so currentLayout() or newLayout() is the usual start. NULL means the script was not started from that kind of window; then call newLayout() (or the matching newSchematic). Reports from long operations are available as lastReportText and lastReportRang even if the user never saw the dialog.

Example:

layout *l = project::currentLayout();
if (l == NULL)
 l = project::newLayout();
l->drawing->point(0, 0);
l->drawing->point(1000, 2000);
l->drawing->box();

Member Function Documentation


static layout* project::currentLayout()

If the window that started the script is a layout window, that layout is returned. In a C++ macro this is the same window as the global layout pointer. In in-process Python there is no global layout, so this is the usual way to get the window. NULL is returned if the script was not started from a layout window.

Returns: the current layout window, or NULL.

Examples:

// direct ways to access the calling window:
layout->drawing->point(0,0);
layout->drawing->point(1000,2000);
layout->drawing->box();

//receiving the pointer via the project class:
layout *l=project::currentLayout();
if (l==NULL) l=project::newLayout();
l->drawing->point(0,0);
l->drawing->point(1000,2000);
l->drawing->box();
 l=project.currentLayout()
 if l is None: l=project.newLayout();

 #the existing layout window is used for this point
 l.drawing.point(0,0)
 l.drawing.point(1000,2000)
 l.drawing.box()

(introduced with release 20260616)


static schematic project::currentSchematic()

Same as currentLayout, but for the schematic window that started the script.

Returns: that schematic, or NULL if the script was not started from a schematic.

(introduced with release 20260616)


static textEdit* project::currentTextEditor()

Same as currentLayout, but for the text editor window that started the script.

Returns: that textEdit, or NULL if the script was not started from a text editor.

(introduced with release 20260616)


static void project::closeLayout(layout *l)

Closes and unregisters layout window l.


static void project::closeLayout3d(layout3d *l)

Closes and unregisters 3d window l.


static void project::closeSchematic(schematic *s)

Closes and unregisters schematic window s.


static bool project::defaultGui

If true, new layout and schematic windows get the standard toolbars and menus. If false, every menu and toolbar must be added by hand.


static textEdit * project::getCentralTextEditor()

Returns: a pointer to the central text editor used for reports and error messages.


static layout* project::getLayout(schematic *s)

Returns: the layout window linked with schematic s. If none exists, one is created.


static layout3d* project::getLayout3d(layout *l)

Returns: the 3d window linked with layout l. If none exists, one is created.


static textEdit* project::getOpenTextEditor()

Returns: a pointer to an open text editor. Opens a new Text Editor if none is open.


static schematic project::getSchematic(layout *lay)

Returns: the schematic window linked with layout lay. If none exists, one is created.


static bool project::hasSchematic(layout *lay)

Returns: true if layout lay already has a connected schematic window.


static int project::lastReportRang()

Some longer operations build a report that may be shown to the user, depending on setup. This method returns the severity of that report. (introduced with release 20250129)

Returns: the report range:

Values: Report Rang:
0 fatal error
1 error
2 string warning
3 warnings
4 information
5 no further comments

static string project::lastReportText()

Returns: the full report text, whether or not it was shown to the user. (introduced with release 20250129)


static layout* project::newLayout()

Creates a new layout window.

Returns: a pointer to that window. In C++ macros use the keyword class to separate the type layout from the existing pointer layout.

class layout *myLayout=project::newLayout();
myLayout->open("filename");

static layout* project::newSchematic()

Creates a new schematic window.

Returns: a pointer to the new window.


static void project::updateMacros()

Calls updateMacros on every layout, schematic, and text editor window, so a change to setup::macroPath takes effect everywhere. (introduced with release 20260720)