pycatia.in_interfaces.application¶
- class pycatia.in_interfaces.application.Application(com_object)¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
System.IUnknownSystem.IDispatchSystem.CATBaseUnknownSystem.CATBaseDispatchSystem.AnyObjectApplicationRepresents the current CNext application and its frame window.The application is the root object for all the other objects you can use andaccess from scripts. It directly aggregates:The document collection represented by the Documents object. Thiscollection contains all the documents currently opened by theapplicationThe window collection represented by the Windows object. This collectioncontains all the windows currently opened by the application, each windowdisplaying one of the documents contained in the documentcollectionThe SystemService object, providing information about the systemenvironment.The active document and the active window are two key objects for theapplication you can access using the ActiveDocument and ActiveWindow propertiesrespectively. The active window is the window the end user is currently workingin, and the active document is the document displayed in this active window andthat the end user is being editing. This document sets its workshop, that isthe available menus and toolbars that make it possible to edit it, according toits type.When you create or use macros for in-process access, the application is alwaysreferred to as CATIA.- property active_document: Document¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property ActiveDocument() As Document (Read Only)Returns the active document. The active document is the document the enduser is being editing.Example:This example retrieves in ActiveDoc the active document of the CATIAapplication.Dim ActiveDoc As DocumentSet ActiveDoc = CATIA.ActiveDocument- Return type:
- property active_printer: Printer¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property ActivePrinter() As PrinterReturns or sets the active printer. The active printer is the printer onwhich documents are printedExample:This example retrieves in ActivePrinter the active printer of the CATIAapplication.Dim ActivePrinter As PrinterSet ActivePrinter = CATIA.ActivePrinter- Return type:
- property active_window: Window¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property ActiveWindow() As Window (Read Only)Returns the active window. The active window is the window in which the enduser is currently editing the active document.Example:This example retrieves in ActiveWin the active window of the CATIAapplication.Dim ActiveWin As WindowSet ActiveWin = CATIA.ActiveWindow- Return type:
- property cache_size: int¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property CacheSize() As longReturns or sets the default local cache size used by theapplication.Example:This example sets the cache size for by the CATIA application to thosedefined in LocalCacheSize.LocalCacheSize= 10CATIA.CacheSize = LocalCacheSize- Return type:
int
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Caption() As CATBSTRReturns or sets the application’s window title. This title is displayed inthe application’s window title bar.Example:This example retrieves in Title the CATIA application’s windowtitle.Title = CATIA.CaptionThe returned value is like this:CNext- Return type:
str
- create_send_to() SendToService ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Func CreateSendTo() As SendToServiceCreates a Send TO.Role:This method creates a SendToService instance.Warning : CATIASendToService interface requires theinstallation of CATIA - PPR xPDM Gateway 1 Product (PX1)In case this product is not granted, the first invocationto one of CATIASendToService methods will fail.- Return type:
- disable_new_undo_redo_transaction() None ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Sub DisableNewUndoRedoTransaction()Prevents new Undo/Redo transaction creation.If too many Undo/Redo transactions are created during macro execution, itmay affect performance. So it is valuable to prevent Undo/Redo transactioncreation during macro execution when lots of data are created, deleted ormodified.Note: preventing Undo/Redo transaction creation must not be done when aselection is required in the macroDo not forget to call EnableNewUndoRedoTransaction at the end of the macroor before selection to restore the common behavior.Example:This example prevents new transactions to be created, which mayincrease performance.CATIA.DisableNewUndoRedoTransaction()- Return type:
None
- property display_file_alerts: bool¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property DisplayFileAlerts() As booleanReturns or sets the application ability to display filealerts.True if the application enables file alert display.True is the default. A file alert is, for example, the dialog box thatprompts you that the file you want to save is in read only mode, or that thefile you want to close needs to be saved. It could be handy to disable thesefile alerts for automation since they may freeze your macro execution, waitingfor an end user input in the displayed dialog box.Example:This example disables file alerts for the CATIAapplication.CATIA.DisplayFileAlerts = False- Return type:
bool
- property documents: Documents¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Documents() As Documents (Read Only)Returns the collection of documents currently managed by theapplication.Example:This example retrieves in DocCollection the collection of documentscurrently managed by the CATIA application.Dim DocCollection As DocumentsSet DocCollection = CATIA.Documents- Return type:
- enable_new_undo_redo_transaction() None ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Sub EnableNewUndoRedoTransaction()Allows new Undo/Redo transaction creation.Example:This example restores the common behavior afterDisableNewUndoRedoTransaction has been called.CATIA.EnableNewUndoRedoTransaction()- Return type:
None
- property file_search_order: str¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property FileSearchOrder() As CATBSTRReturns or sets the default path concatenation.Role: This property returns or sets the default path concatenation used byOther folders setting of the Linked Documents Localization function. Theprimary aim of the Linked Documents Localization function is to resolvedocument links and to manage the strategy that will be used to locate yourlinked documents.Example:This example sets the paths to search for by the CATIA application tothose defined in PathConcatenation.PathConcatenation = “/u/users/fbq/db/model:/u/users/psr/db/model”CATIA.FileSearchOrder = PathConcatenationTheese methods require the installation of CATIA - PPR xPDM Gateway 1Product (PX1) In case this product is not granted, the first invocation to oneof the methods will fail.- Return type:
str
- file_selection_box(i_title: str, i_extension: str, i_mode: int) str ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Func FileSelectionBox(CATBSTR iTitle,CATBSTR iExtension,CatFileSelectionMode iMode) As CATBSTRDisplays a modal dialog box which can be used to select / enter the name ofa file to open / save.Parameters:iTitleThe title of the dialog box.iExtensionA file extension filter.iModeThe mode in which to run the dialog box (eitherCatFileSelectionModeOpen or CatFileSelectionModeSave.oFilePathThe return string containing the full path of the selected file, ora zero-length string if the user selects Cancel.Example:This example asks the user to select a text file and prints thepath of the selected file.filepath = CATIA.FileSelectionBox(“Select a text file”,“*.txt”, CatFileSelectionModeOpen)CATIA.SystemServices.Print “The selected file is “ &filepath- Parameters:
i_title (str) –
i_extension (str) –
i_mode (int) – enum cat_file_selection_mode
- Return type:
str
- property file_system: FileSystem¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property FileSystem() As FileSystem (Read Only)Returns the file system. The file system provides access to a computer’sfile system.Example:This example retrieves in AppliFileSys the file sytem of the CATIAapplication.Dim AppliFileSys As FileSystemSet AppliFileSys = CATIA.FileSystem- Return type:
- property full_name: str¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property FullName() As CATBSTR (Read Only)Returns the application’s executable file full name, including its path.This name is the name of the executable file used to start theapplication.Example:This example retrieves in ApplicationFullName the CATIA application’sexecutable file full name.ApplicationFullName = CATIA.FullNameThe returned value is like this:\lisacxr1arelbsfalpha_acodebinCNEXT.exe- Return type:
str
- get_workbench_id() str ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Func GetWorkbenchId() As CATBSTRReturns the identifier of the CATIA current workbench.Parameters:oworkbenchIdThe id of the current workbench.- Return type:
str
- property height: float¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Height() As floatReturns or sets the height of the application’s frame window. The height isexpressed in pixels.Example:This example sets the height of the CATIA application’s frame window to300 pixels.CATIA.Height = 300- Return type:
float
- help(i_help_id: str) None ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Sub Help(CATBSTR iHelpID)Displays application’s online help.Parameters:iHelpIDIdentifier of the help message to displayExample:This example displays the string referred to by the HelpKey message keyin the message catalog concatenation.CATIA.Help(“HelpKey”)- Parameters:
i_help_id (str) –
- Return type:
None
- property hso_synchronized: bool¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property HSOSynchronized() As booleanFor selection performance purposes, returns or sets the HSO synchronizationin comparison with the CSO.Role: Precises if, for all Selection object instances, the HSO (HighlightedSet of Objects) is synchronized in comparison with the CSO (Current Set ofObjects).Valid values are:True: In this case, Selection methods work directly with CATIA’s CSO,to reflect instantly the changes made in Automation Selection. This ensurescorrect selection results, but may impact performance in certaincases.This is the default value at the beginning of a CATIAsession.False: In this case, Selection methods work with an internal SO buffer,which allows faster execution when performing a large number of CSO-independentSelection calls, or when performing a single Selection call working on a largenumber of objects (usually the Search method). This may also prevent thefeatures from blinking between two user interactions.Note: even if this property is set to False, the HSO is synchronized incomparison with the CSO at the begining of the followingmethods:Selection.SelectElement2Selection.SelectElement3Selection.SelectElement4Selection.IndicateOrSelectElement2DSelection.IndicateOrSelectElement3DApplication.StartCommandCAUTION: If you use the False value of this property, you must make sure toreset it to True for CATIA’s CSO to reflect properly the changes made inAutomation Selection. For example, it should be reset to True beforeinteractive parts of your script: MsgBox, InputBox calls, VBA forms updates andso on.- Return type:
bool
- input_box(prompt: str, title: str = '', default: str = '') str ¶
Display InputBox in catia. Default position is in the center screen.
More information on https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/inputbox-function
- Parameters:
prompt (str) – Required. String expression displayed as the message in the dialog box.
title (str) – Optional. The default is ‘’. String expression displayed in the title bar of the dialog box.
default (str) – Optional. The default is ‘’. String expression displayed in the text box as the default response if no other input is provided. If you omit default, the text box is displayed empty.
- Returns:
str
- property interactive: bool¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Interactive() As booleanReturns or sets the application sensitivity to end userinteractions.True if the application is end user interaction sensitive.Example:This example makes the CATIA application sensitive to end userinteractions.CATIA.Interactive = True- Return type:
bool
- property left: float¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Left() As floatReturns or sets the distance from the application’s frame window left sideto the left side of the screen. This distance is expressed inpixels.Example:This example sets the distance from the CATIA application’s framewindow left side to the left side of the screen to 150pixels.CATIA.Left = 150- Return type:
float
- property local_cache: str¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property LocalCache() As CATBSTRReturns or sets the default local cache path used by theapplication.Example:This example sets the cache path for by the CATIA application to thosedefined in LocalCachePath.LocalCachePath= “/tmp/cache”CATIA.LocalCache = LocalCachePath- Return type:
str
- message_box(message_text: str, buttons: int = 0, title: str = '')¶
The button values
Constant
Value
Description
vbOKOnly
0
Display OK button only.
vbOKCancel
1
Display OK and Cancel buttons.
vbAbortRetryIgnore
2
Display Abort, Retry, and Ignore buttons
vbYesNoCancel
3
Display Yes, No, and Cancel buttons.
vbYesNo
4
Display Yes and No buttons.
vbRetryCancel
5
Display Retry and Cancel buttons.
vbCritical
16
Display Critical Message icon.
vbQuestion
32
Display Warning Query icon.
vbExclamation
48
Display Warning Message icon.
vbInformation
64
Display Information Message icon.
vbDefaultButton1
0
First button is default.
vbDefaultButton2
256
Second button is default.
vbDefaultButton3
512
Third button is default.
vbDefaultButton4
768
Fourth button is default.
vbApplicationModal
0
Application modal; the user must respond to the message box before continuing work in the current application.
vbSystemModal
4096
System modal; all applications are suspended until the user responds to the message box.
vbMsgBoxHelpButton
16384
Adds Help button to the message box.
vbMsgBoxSetForeground
65536
Specifies the message box window as the foreground window.
vbMsgBoxRight
524288
Text is right-aligned.
vbMsgBoxRtlReading
1048576
Specifies text should appear as right-to-left reading on Hebrew and Arabic systems.
Return values
Constant
Value
Description
vbOK
1
OK
vbCancel
2
Cancel
vbAbort
3
Abort
vbRetry
4
Retry
vbIgnore
5
Ignore
vbYes
6
Yes
vbNo
7
No
Example:
This creates a message box with the buttons abort, retry ignore and displays the Warning Query icon. >>> from pycatia import catia >>> buttons = 2 + 32 >>> result = catia.message_box('Hello World!?', buttons=buttons, title='Asking a question.') >>> # result = 3 if the user presses Abort.
- Parameters:
message_text (str) – Text to be displayed in the message box window.
buttons (int) – Defines the message box configuration. See example.
title (str) – Text to be displayed in the message box title bar.
- Returns:
Returns an int which is representative of the button pressed.
- Return type:
int
- property path: Path¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Path() As CATBSTR (Read Only)Returns the path of the application’s executable files.Example:This example retrieves in ApplicationPath the path where the CATIAapplication executable files are located.ApplicationPath = CATIA.PathThe returned value is like this:\lisacxr1arelbsfalpha_acodebin- Return type:
Path
- property printers: Printers¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Printers() As Printers (Read Only)Returns the collection of the printers currently managed by theapplication.Example:This example retrieves in PrintersCollection the collection of theprinters currently managed by the CATIA application.Dim PrintersCollection As WindowsSet PrintersCollection = CATIA.Printers- Return type:
- quit() None ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Sub Quit()Exits the application and closes all open documents.Example:This example exits the CATIA application and closes all its opendocuments.CATIA.Quit()- Return type:
None
- property refresh_display: bool¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property RefreshDisplay() As booleanEnables or disables the update of the display during the script replay. Toimprove performance, this update can be temporarely disabled by setting thisproperty to False in the script.True (value set by default) if the application’s display is refreshed aftereach method call executed in late binding mode . This property does not affectearly binding calls nor the get methods because they are never followed by arefresh of the display.Example:This example makes the update of the CATIA application’s displaydisabled during the script replay.CATIA.RefreshDisplay = False- Return type:
bool
- setting_controllers() SettingControllers ¶
Application.SettingControllers
- start_command(i_command_id: str) None ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Sub StartCommand(CATBSTR iCommandId)Starts a CATIA command.Role:This method starts a command and executes it untill its firstinteraction. Please notice interactions such as selections you could add afterin your macro will not work. StartCommand is useful to execute one-shot (notinteractive) commands, it is not safe for interactivecommands.Parameters:iCommandIdThe id of the command to be started. This id can be the name of thecommand or its alias.- Parameters:
i_command_id (str) –
- Return type:
None
- start_workbench(iworkbench_id: str) None ¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445))
o Sub StartWorkbench(CATBSTR iworkbenchId)Starts a CATIA workbench.Parameters:iworkbenchIdThe id of the workbench to be started.- Parameters:
iworkbench_id (str) –
- Return type:
None
- property status_bar: str¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property StatusBar() As CATBSTRReturns or sets the text displayed in the application’s window statusbar.Example:This example retrieves in Text the text displayed in the CATIAapplication’s window status bar.Text = CATIA.StatusBarThe returned value is like this:Welcome to CATIA CxR1- Return type:
str
- property system_configuration: SystemConfiguration¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property SystemConfiguration() As SystemConfiguration (ReadOnly)Returns the system configuration object (an object which provides access tosystem or configuration dependent resources).Parameters:oConfigurationThe system configuration object.- Return type:
- property system_service: SystemService¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property SystemService() As SystemService (Read Only)Returns system services.Example:This example retrieves in AppliSysSer the CATIA application’s systemservices.Dim AppliSysSer As SystemServiceSet AppliSysSer = CATIA.SystemService- Return type:
- property top: float¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Top() As floatReturns or sets the distance from the application’si frame window top tothe top of the screen. This distance is expressed inpixels.Example:This example sets the distance from the CATIA application’s framewindow top to the top of the screen to 50 pixels.CATIA.Top = 50- Return type:
float
- property undo_redo_lock: bool¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property UndoRedoLock() As booleanReturns or sets the application status about Undo/Redo.True if the Undo/Redo mechanism is locked.False is the default. Since Undo/Redo mechanism uses lots of memory, it canbe useful to disable it during consuming operations. Then Undo and Redo stacksare flushed and no model modification is kept until the Undo/Redo mechanism isunlocked. It is mandatory to unlock it before the end of themacro.Example:This example disables Undo/Redo mechanism until it isunlocked.CATIA.UndoRedoLock = True- Return type:
bool
- property visible: bool¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Visible() As booleanReturns or sets the application’s window visibility.True if the application’s window is visible to the enduser.Example:This example makes the CATIA application’s windowvisible.CATIA.Visibility = True- Return type:
bool
- property width: float¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Width() As floatReturns or sets the width of the application’s frame window. The width isexpressed in pixels.Example:This example sets the width of the CATIA application’s frame window to350 pixels.CATIA.Width = 350- Return type:
float
- property windows: Windows¶
Note
CAA V5 Visual Basic Help (2020-06-11 12:40:47.360445)
o Property Windows() As Windows (Read Only)Returns the collection of windows currently managed by theapplication.Example:This example retrieves in WinCollection the collection of windowscurrently managed by the CATIA application.Dim WinCollection As WindowsSet WinCollection = CATIA.Windows- Return type: