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:

  1. Prolog
  2. Initialize an Application
  3. Get a PspClass Object
  4. Get Physical, Function and Connector Types Used by Application
  5. Get a PspAppFactory Object
  6. Get the List of Physical Parts, Functionns and Groups Objects
  7. Get a PspResource Object
  8. Get Resource Information

Prolog

The 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 Application

Using 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 Object

The 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 Application

The macro calls local private subroutine QueryPspClass by passing objPspClass as an argument to it to get following startup type information

  1. List of Class types of Physical Parts is retrieved by using StartUpPhysicals method
  2. List of Class types of Functions is retrieved by using StartUpFunctions method
  3. List of Class types of Connectors is retrieved by using StartUpConnectors method
  ...
      -----------------------------------------------------------------------
      ' 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 Object

The 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 Objects

The macro calls local private subroutine QueryPspAppFactory , by passing objPspAppFactory and the root product objPrdRoot as arguments to get following information

  1. List of physical parts that are used in the document under the root product.
  2. List of Logical Lines
  3. List of Groups
    ...
      '-----------------------------------------------------------------------
      ' 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 Object

The 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 Information

The 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]


In Short

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]


References

[1] Replaying a Macro
[Top]

Copyright © 2004, Dassault Systèmes. All rights reserved.