Distributive Systems |
Initializing and Querying Plant Ship Applications |
![]() |
This use case is intended to to show you how to activate a Plant Ship application, query startup types, and get the name and location of the application resources This macro opens the document CAAPspEduIn.CATProduct. |
![]() |
CAAPspApplication is launched in CATIA [1]. No open document is needed. CAAPspApplication.CATScript is located in the CAAScdPspUseCases module. Execute macro (windows only). |
![]() |
CAAPspApplication includes the following steps:
PrologThe macro first loads Distributive System document CAAPspEduIn.CATProduct containing Equipment and Piping Design objects. ... ' ------------------------------------------------------------------------- ' Open the Distributive system document Dim objPspDoc As Document sDocFullPath = CATIA.FileSystem.ConcatenatePaths(sDocPath, _ "\online\CAAScdPspUseCases\samples\CAAPspEduIn.CATProduct" ) Set objPspDoc = CATIA.Documents.Open(sDocFullPath) ... Note: To open a different document, modify the variable sDocPath to point to the directory and sDocFullPath to point to full path name of the document. Next, the macro acquires the PspWorkbench object from the document using the top node of the object tree in a Distributive System document. ... If ( Not ( objPspDoc Is Nothing ) ) Then Set objPrdRoot = objPspDoc.Product If ( Not ( objPrdRoot Is Nothing ) ) Then Set objPspWorkbench = objPrdRoot.GetTechnologicalObject ("PspWorkbench") ... Initialize an ApplicationUsing GetApplication method of objPspWorkbench, an application object (PspApplication) is retrieved whose Application ID is catPspIDLCATPiping. ... If ( Not ( objPspWorkbench Is Nothing ) ) Then Set objPspApplication = objPspWorkbench.GetApplication(catPspIDLCATPiping) If ( objPspApplication Is Nothing ) Then strMessage_g = strMessage_g & "Unable to get objPspApplication" & vbCr Else strMessage_g = strMessage_g & "Success in getthing objPspApplication" & vbCr objPspApplication.Initialization() ... The macro then calls Initialization method on objPspApplication object to initialize the application data. ... objPspApplication.Initialization() ... Get a PspClass ObjectThe macro retrieves a PspClass object on the objPspApplication by using GetInterface method of objPspWorkbench. ... Set objPspClass = objPspWorkbench.GetInterface("CATIAPspClass",objPspApplication ) ... Get Physical, Function and Connector Types Used by ApplicationThe macro calls local private subroutine QueryPspClass by passing objPspClass as an argument to it to get following startup type information
... ----------------------------------------------------------------------- ' Get StartUpPhysicals '----------------------------------------------------------------------- Set objLStrPhysicals = objPspClassArg.StartUpPhysicals If ( Not ( objLStrPhysicals Is Nothing ) ) Then intNbPhysicals = objLStrPhysicals.Count strMessage_g = strMessage_g & _ "Number of StartUpPhysicals=" & intNbPhysicals & vbCr End If Set objLStrFunctions = objPspClassArg.StartUpFunctions If ( Not ( objLStrFunctions Is Nothing ) ) Then intNbFunctions = objLStrFunctions.Count strMessage_g = strMessage_g & _ "Number of StartUpFunctions=" & intNbFunctions & vbCr End If Set objLStrConnectors = objPspClassArg.StartUpConnectors ... Get a PspAppFactory ObjectThe macro retrieves a PspAppFactory object (objPspAppFactory ) on the objPspApplication by using GetInterface method of objPspWorkbench. ... If ( Not ( objPspWorkbench Is Nothing ) And _ Not ( objPspApplication Is Nothing ) ) Then Set objPspAppFactory = objPspWorkbench.GetInterface("CATIAPspAppFactory",objPspApplication ) ... Get the List of Physical Parts, Functionns and Groups ObjectsThe macro calls local private subroutine QueryPspAppFactory , by passing objPspAppFactory and the root product objPrdRoot as arguments to get following information
... '----------------------------------------------------------------------- ' Get ListPhysicals '----------------------------------------------------------------------- Set objLPhysicals = objPspAppFactoryArg.ListPhysicals (objRootPrdArg, catPspIDLNone) If ( Not ( objLPhysicals Is Nothing ) ) Then iNbPhysicals = objLPhysicals.Count strMessage_g = strMessage_g & _ "Number of Physicals=" & iNbPhysicals & vbCr End If '------------------------------------------------------------ ' Get ListLogicalLines '------------------------------------------------------------ Set objLLogLines = objPspAppFactoryArg.ListLogicalLines (objRootPrdArg) If ( Not ( objLLogLines Is Nothing ) ) Then iNbLogLines = objLLogLines.Count strMessage_g = strMessage_g & _ "Number of Logical Lines=" & iNbLogLines & vbCr End If Set objLGroups = objPspAppFactoryArg.ListGroups (objRootPrdArg) ... Get a PspAppResource ObjectThe macro retrieves a PspResource object (objPspResource) on the objPspApplication by using GetInterface method of objPspWorkbench. ... If ( Not ( objPspWorkbench Is Nothing ) And _ Not ( objPspApplication Is Nothing ) ) Then Set objPspResource = objPspWorkbench.GetInterface("CATIAPspResource", _ objPspApplication ) ... Get Resource InformationThe application resources are defined in a Project Resource Management xml file by the project administrator. PspResource object used to retrieves the directory paths, file names or data values for the resources defined in the Project resource management xml file. ... strResNamePipingParts = "PipingPartsCatalog" If ( Not ( objPspResourceArg Is Nothing ) ) Then strCatalogPartName = objPspResourceArg.GetResourcePath( _ strResNamePipingParts) strMessage_g = strMessage_g & _ "PipingPartsCatalog= " & _ strCatalogPartName & vbCr ... |
[Top]
This use case is intended to show you how to activate a Plant Ship application, query startup types, and get information on the resources. A message logging the status of the critical steps is displayed at the end of the use case.
[Top]
[1] | Replaying a Macro |
[Top] |
Copyright © 2004, Dassault Systèmes. All rights reserved.