当前位置:网站首页>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)
边栏推荐
- Database execution error: SQL_ mode only_ full_ group_ by:
- [kotlin learning] classes, objects and interfaces - define class inheritance structure
- 2022-2-14 learning the imitation Niuke project - send email
- [point cloud processing paper crazy reading classic version 14] - dynamic graph CNN for learning on point clouds
- AcWing 785. Quick sort (template)
- [point cloud processing paper crazy reading frontier version 11] - unsupervised point cloud pre training via occlusion completion
- Powerdesign reverse wizard such as SQL and generates name and comment
- Liteide is easy to use
- LeetCode 532. K-diff number pairs in array
- 【毕业季|进击的技术er】又到一年毕业季,一毕业就转行,从动物科学到程序员,10年程序员有话说
猜你喜欢
![[point cloud processing paper crazy reading classic version 14] - dynamic graph CNN for learning on point clouds](/img/7d/b66545284d6baea2763fd8d8555e1d.png)
[point cloud processing paper crazy reading classic version 14] - dynamic graph CNN for learning on point clouds
![[point cloud processing paper crazy reading classic version 12] - foldingnet: point cloud auto encoder via deep grid deformation](/img/62/edb888200e3743b03e5b39d94758f8.png)
[point cloud processing paper crazy reading classic version 12] - foldingnet: point cloud auto encoder via deep grid deformation

IDEA 中使用 Hudi

AcWing 787. Merge sort (template)

State compression DP acwing 91 Shortest Hamilton path

Build a solo blog from scratch

Low code momentum, this information management system development artifact, you deserve it!

Crawler career from scratch (II): crawl the photos of my little sister ② (the website has been disabled)
![[kotlin learning] control flow of higher-order functions -- lambda return statements and anonymous functions](/img/a3/b442508af9b059d279cffb34dee9bf.png)
[kotlin learning] control flow of higher-order functions -- lambda return statements and anonymous functions

With low code prospect, jnpf is flexible and easy to use, and uses intelligence to define a new office mode
随机推荐
[advanced feature learning on point clouds using multi resolution features and learning]
STM32F103 can learning record
Simple use of MATLAB
CSDN markdown editor help document
[point cloud processing paper crazy reading classic version 13] - adaptive graph revolutionary neural networks
What is an excellent fast development framework like?
Windows安装Redis详细步骤
Sword finger offer II 029 Sorted circular linked list
LeetCode 532. K-diff number pairs in array
The idea of compiling VBA Encyclopedia
[set theory] order relation (chain | anti chain | chain and anti chain example | chain and anti chain theorem | chain and anti chain inference | good order relation)
Save the drama shortage, programmers' favorite high-score American drama TOP10
AcWing 786. Number k
Using Hudi in idea
Derivation of Fourier transform
State compression DP acwing 291 Mondrian's dream
【点云处理之论文狂读经典版8】—— O-CNN: Octree-based Convolutional Neural Networks for 3D Shape Analysis
Powerdesign reverse wizard such as SQL and generates name and comment
IDEA 中使用 Hudi
Spark structured stream writing Hudi practice