当前位置:网站首页>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)
边栏推荐
- Move anaconda, pycharm and jupyter notebook to mobile hard disk
- Detailed steps of windows installation redis
- Construction of simple database learning environment
- 【Kotlin学习】类、对象和接口——带非默认构造方法或属性的类、数据类和类委托、object关键字
- Beego learning - JWT realizes user login and registration
- Overview of database system
- ERROR: certificate common name “*.” doesn’t match requested ho
- Crawler career from scratch (IV): climb the bullet curtain of station B through API
- Hudi 数据管理和存储概述
- 2022-1-6 Niuke net brush sword finger offer
猜你喜欢
2022-2-13 learning the imitation Niuke project - home page of the development community
【点云处理之论文狂读经典版7】—— Dynamic Edge-Conditioned Filters in Convolutional Neural Networks on Graphs
Digital statistics DP acwing 338 Counting problem
[point cloud processing paper crazy reading classic version 10] - pointcnn: revolution on x-transformed points
Basic knowledge of network security
Install third-party libraries such as Jieba under Anaconda pytorch
State compression DP acwing 91 Shortest Hamilton path
Crawler career from scratch (II): crawl the photos of my little sister ② (the website has been disabled)
Excel is not as good as jnpf form for 3 minutes in an hour. Leaders must praise it when making reports like this!
Just graduate student reading thesis
随机推荐
Go language - Reflection
CATIA automation object architecture - detailed explanation of application objects (I) document/settingcontrollers
Filter comments to filter out uncommented and default values
【点云处理之论文狂读前沿版11】—— Unsupervised Point Cloud Pre-training via Occlusion Completion
Overview of image restoration methods -- paper notes
LeetCode 241. Design priorities for operational expressions
PowerDesigner does not display table fields, only displays table names and references, which can be modified synchronously
NPM install installation dependency package error reporting solution
2022-2-14 learning the imitation Niuke project - send email
State compression DP acwing 91 Shortest Hamilton path
【点云处理之论文狂读经典版11】—— Mining Point Cloud Local Structures by Kernel Correlation and Graph Pooling
AcWing 788. Number of pairs in reverse order
CSDN markdown editor help document
LeetCode 532. K-diff number pairs in array
Just graduate student reading thesis
dried food! What problems will the intelligent management of retail industry encounter? It is enough to understand this article
Computing level network notes
Digital management medium + low code, jnpf opens a new engine for enterprise digital transformation
Linxu learning (4) -- Yum and apt commands
WARNING: You are using pip ; however. Later, upgrade PIP failed, modulenotfounderror: no module named 'pip‘