当前位置:网站首页>CATIA automation object architecture - detailed explanation of application objects (III) systemservice
CATIA automation object architecture - detailed explanation of application objects (III) systemservice
2022-07-03 09:24:00 【zeng31403】
Application object
Application A child of an object :
6. SystemService: utilize application Access to system services
The figure below shows that we can use Application.SystemService What system services are available
**Application.SystemService.Environ:** Get the value of the system environment variable , Return text format .
Such as obtaining system variables “Path” Value :
Dim strSysPath As String
strSysPath = CATIA.SystemService.Environ("Path")
MsgBox strSysPath
result : This Path There are many values of variables , So the display is more complex
Theoretically , We can use this method to get the values of all system variables :
**Application.SystemService.Evaluate:** utilize Evaluate Method executes a script statement , And return the execution result
Func Evaluate( CATBSTR iScriptText, CATScriptLanguage iLanguage,
CATBSTR iFunctionName, CATSafeArrayVariant iParameters) As CATVariant
for example :
Dim params() ' Define the statement parameter array
Dim codeToEvaluate ' Define the executed statement
CodeToEvaluate = "Sub CATMain()" & vbNewLine & "MsgBox " & chr(34) & "Hello World" & chr(34) &vbNewLine _
& "End Sub"
'CATVBScriptLanguage Is the name of the script language CATVBScript
'CATIA.SystemService.Evaluate ( Script statements , Script language name , The name of the function , Execute parameter array )
CATIA.SystemService.Evaluate CodeToEvaluate, CATVBScriptLanguage, "CATMain", params
CodeToEvaluate Script content for
Theoretically , except CATVBScriptLanguage Script functions written in the following languages are executable
Application.SystemService.ExecuteBackgroundProcessus:
Execute an asynchronous program , Execute in the background without waiting for it to end
Func ExecuteBackgroundProcessus( CATBSTR iExecutablePath) As long
The input parameter is the address of the executing program
for example : perform C:\Program Files\myApp\myApp.exe This procedure
CATIA.SystemService.ExecuteBackgroundProcess “‘C:\Program Files\myApp\myApp.exe’ myArg”
Theoretically, it can also be simplified to the following sentence , If the path has been added to the system variable "Path" in .( Not confirmed )
CATIA.SystemService.ExecuteBackgroundProcess “‘myApp\myApp.exe’ myArg”
although ExecuteBackgroundProcess Function definitions have return values , But it doesn't actually return .
Application.SystemService.ExecuteProcessus:
Execute an asynchronous program , But you need to wait for it to end before you can continue to the next step
Func ExecuteProcessus( CATBSTR iExecutablePath) As long
for example :
Dim ReturnCode as long
ReturnCode = CATIA.SystemService.ExecuteProcessus("")
ExecuteProcessus Return after execution ReturnCode, You can judge whether the execution of the statement ends .
Application.SystemService.ExecuteScript:
Execute a script file
Same as Evaluate The difference is ,ExecuteScript The execution is a written script document , Instead of a scripted statement .
Func ExecuteScript( CATBSTR iLibraryName, CatScriptLibraryType iType,
CATBSTR iProgramName, CATBSTR iFunctionName,
CATSafeArrayVariant iParameters) As CATVariant
iLibraryName ' Library containing scripts
iType ' Script library type , file / Catalog /VBA project
iProgramName ' Program name
iFunctionName ' The name of the function
iParameters ' Program parameters
for example : perform Part1.CATPart Macro scripts included in Macro1.catvbs, Run the main program CATMain
Dim params()
CATIA.SystemService.ExecuteScript "Part1.CATPart", catScriptLibraryTypeDocument, "Macro1.catvbs", "CATMain", params
by this means , You can run all kinds of written in advance CATIA Script files
Application.SystemService.Print:
Output a standard output stream to display text information .
The following statement was not executed successfully , because Print It doesn't seem to support Automation object .
Dim iString
iString = "Hello Word"
CATIA.SystemService.Print (iString)
边栏推荐
- 【点云处理之论文狂读前沿版8】—— Pointview-GCN: 3D Shape Classification With Multi-View Point Clouds
- [point cloud processing paper crazy reading classic version 11] - mining point cloud local structures by kernel correlation and graph pooling
- 【点云处理之论文狂读经典版7】—— Dynamic Edge-Conditioned Filters in Convolutional Neural Networks on Graphs
- 【Kotlin学习】类、对象和接口——带非默认构造方法或属性的类、数据类和类委托、object关键字
- Instant messaging IM is the countercurrent of the progress of the times? See what jnpf says
- CSDN markdown editor help document
- Principles of computer composition - cache, connection mapping, learning experience
- Sword finger offer II 091 Paint the house
- LeetCode 715. Range module
- Hudi 快速体验使用(含操作详细步骤及截图)
猜你喜欢
【点云处理之论文狂读经典版12】—— FoldingNet: Point Cloud Auto-encoder via Deep Grid Deformation
Jenkins learning (II) -- setting up Chinese
MySQL installation and configuration (command line version)
Digital management medium + low code, jnpf opens a new engine for enterprise digital transformation
【点云处理之论文狂读前沿版12】—— Adaptive Graph Convolution for Point Cloud Analysis
2022-2-13 learn the imitation Niuke project - Project debugging skills
Hudi 集成 Spark 数据分析示例(含代码流程与测试结果)
Using Hudi in idea
【点云处理之论文狂读经典版8】—— O-CNN: Octree-based Convolutional Neural Networks for 3D Shape Analysis
[point cloud processing paper crazy reading classic version 14] - dynamic graph CNN for learning on point clouds
随机推荐
LeetCode 513. Find the value in the lower left corner of the tree
LeetCode 508. The most frequent subtree elements and
Hudi 快速体验使用(含操作详细步骤及截图)
LeetCode 241. Design priorities for operational expressions
Hudi 数据管理和存储概述
Powerdesign reverse wizard such as SQL and generates name and comment
Basic knowledge of database design
PowerDesigner does not display table fields, only displays table names and references, which can be modified synchronously
Explanation of the answers to the three questions
Principles of computer composition - cache, connection mapping, learning experience
Django operates Excel files through openpyxl to import data into the database in batches.
How to check whether the disk is in guid format (GPT) or MBR format? Judge whether UEFI mode starts or legacy mode starts?
Sword finger offer II 029 Sorted circular linked list
LeetCode 75. Color classification
LeetCode 57. Insert interval
Bert install no package metadata was found for the 'sacraments' distribution
[kotlin learning] operator overloading and other conventions -- overloading the conventions of arithmetic operators, comparison operators, sets and intervals
Crawler career from scratch (IV): climb the bullet curtain of station B through API
Filter comments to filter out uncommented and default values
Banner - Summary of closed group meeting