Distributive Systems

Querying Function/Physical/Spatial Integration Data


This use case is intended to show you how to obtain integration data from function, physical and spatial objects using a macro.

This macro opens the document CAAPspEduIn.CATProduct. Using the root node of the document, it then finds a Physical object and then it gets associated Function and Spatial object to it to get integration data.

CAAPspFunctionsPhysical is launched in CATIA [1]. No open document is needed.

CAAPspFunctionPhysical.CATScript is located in the CAAScdPspUseCases module. Execute macro (windows only).

CAAPspFunctionsPhysical includes the following steps:

  1. Prolog
  2. Get a Physical Object
  3. Retrieving Spatial and Functional Object Associated with a Physical Object
  4. Query Spatial Information
  5. Query Function-Physical Integration Information

Prolog

The macro first loads Distributive System document CAAPspEduIn.CATProduct containing Equipment and Piping Design objects.

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.

    ...
    ' ------------------------------------------------------------------------- 
    ' 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)
    ...

Next, the macro acquires the PspWorkbench object from the document using the top node of the object tree in a Distributive System document.

    ...
    ' Find the top node of the Distributive System object tree - .  
    
      Set objPrdRoot = objPspDoc.Product 
      If ( Not ( objPrdRoot Is Nothing ) ) Then
        Set objPspWorkbench = objPrdRoot.GetTechnologicalObject ("PspWorkbench")
      End If
    End If
    ...

Next, the macro acquires the PspApplication object corresponding to Piping application and initializes the application data.

    ...
    If ( Not ( objPspWorkbench Is Nothing ) ) Then
      Set objPspApplication = objPspWorkbench.GetApplication(catPspIDLCATPiping)
    ...

Next, the macro acquires the PspAppFactory and PspRsource object on the application object.

    ...
     If ( Not ( objPspWorkbench Is Nothing ) And _
          Not ( objPspApplication Is Nothing ) ) Then
                        
      Set objPspAppFactory = objPspWorkbench.GetInterface("CATIAPspAppFactory", _
                                                objPspApplication )      
      Set objPspResource = objPspWorkbench.GetInterface("CATIAPspResource", _
                                                objPspApplication )            
    ...

Get a Physical Object

Using the PspAppFactory method ListPhysicals, it obtains a list of physical objects in the Piping domain under the root product. Note that the output of this method is a list of objects. The member of this list can be retrieved using the Item method. The second argument of this method specifies a particular interface to be returned on this object.

It then uses the first physical object and obtains a CATIAPSpPhysical interface handle on the object

  ...
    If ( Not ( objPspAppFactory Is Nothing ) ) Then

        Set objLPhysicals = objPspAppFactory.ListPhysicals ( objPrdRoot , catPspIDLCATPIP)
        If ( Not ( objLPhysicals Is Nothing ) And _
           ( objLPhysicals.Count > 0 ) ) Then
          Set objPspPhysical =  objLPhysicals.Item( 1, "CATIAPspPhysical" )
  ...

Retrieving Spatial and Functional Object Associated with a Physical Object

It calls functions GetSpatial and GetFunctional on the PspPhysical object to obtain PspSpatial object and PspFunctional object associated with it.

    ...
    '-----------------------------------------------------------------------
    ' Get Spatial object and Functional Object
    '-----------------------------------------------------------------------

    If ( Not ( objPspWorkbench Is Nothing ) And _
         Not ( objPspPhysical Is Nothing ) ) Then  

      Set objPspSpatial = objPspPhysical.GetSpatial     
      Set objPspFunctional = objPspPhysical.GetFunctional           
    ...

Query Spatial Information

This macro calls local private subroutine QuerySpatial to get information on the PspSpatial object.

    ...
    '-----------------------------------------------------------------------
    ' Query Spatial Information
    '-----------------------------------------------------------------------
    
    If( Not ( objPspSpatial Is Nothing )) Then
        QuerySpatial objPspSpatial
    End if
    ...

    Private Sub QuerySpatial (objPspSpatialArg As PspSpatial)  
    ...   

A spatial object can be associated to multiple physical objects. In the subroutine QuerySpatial, the macro calls Physicals property on the PspSpatial object to obtain information about the physical objects that are associated with this Spatial object.

   ...   
    If ( Not ( objPspSpatialArg Is Nothing ) ) Then
      '--------------
      ' Get list of physical objects associate with spatial object
      Set objLPhysAssocSpatial = objPspSpatialArg.Physicals

      If ( Not ( objLPhysAssocSpatial Is Nothing ) ) Then
        intNbPhysicals = objLPhysAssocSpatial.Count   
        strMessage_g = strMessage_g & _
           "Number of Physicals Associate with spatial=" & intNbPhysicals & vbCr
   ...

Query Function-Physical Integration Information

This macro calls local private subroutine QueryFunctionalPhysical to get Function-physical integration data.

  ...   
    '-----------------------------------------------------------------------
    ' Query Functional-Physical Information
    '-----------------------------------------------------------------------
    If( Not ( objPspFunctional Is Nothing ) And _
        Not ( objPspPhysical Is Nothing ) And _
        Not ( objPspResource Is Nothing )   ) Then
            
      QueryFunctionalPhysical objPspPhysical, objPhyPspObject, _
                              objPspFunctional, objPspResource
  ...

Local private Subroutine QueryFunctionalPhysical is used to retrieve the following information from a function object:

  • Is function specification driven
  • Is function realized by a physical object, i.e. the function is associated to a placed physical part (with 3D representation and position information)
  ...   
      '--------------------------
      ' Check if the function object IsSpecDriven
      
      bIsSpecDriven = objPspFuncArg.IsSpecDriven
  ...   
      '-------------------------------------------------------
      ' Check if Function object is associated with a placed
      ' physial part

      bIsRealized = objPspFuncArg.IsRealized
  ...
  • It gets a List of physical part types that are compatible with function
  ...   
      '-----------------------------------------
      ' Get Compatible part types
      '-----------------------------------------

      Set objLStrCompPartTypes = objPspFuncArg.GetCompatiblePartTypes (strStdName)

      If ( Not ( objLStrCompPartTypes Is Nothing ) ) Then 
  ...
  • It gets a List physical objects associated to function
   ...   
      Set objLPhysicals = objPspFuncArg.Physicals

      If ( Not ( objLPhysicals Is Nothing ) ) Then  
   ...   

  • It gets Information about the physical object (part type, and part number) that realizes the function
   ...   
      strPartType   = objPspFuncArg.PartType 

      If ( strPartType <> "" ) Then
        strMessage_g = strMessage_g & _
               "Part type of physical object that realized this function = " & _
                strPartType & vbCr    
      End If

      '-----------------------------------------
      ' Get Part Number of the associated physical object
      '-----------------------------------------

      strPartNumber = objPspFuncArg.PartNumber
  ...
  • The part catalog resource name of the physical object associated to the function
 ...       
    
      '-----------------------------------------
      ' Get Catalog Part name of the associated physical object
      '-----------------------------------------

      strCatalogPartName= objPspFuncArg.CatalogPartName
  ...
  • It check if it is OK to associate the function with a physical object
  ...   
      '-----------------------------------------
      ' Check if the associated Physical object is OK to integrate
      '-----------------------------------------

      bIsOkToIntegrate = objPspFuncArg.IsOKToIntegrate
  ...
  • It gets the Function status
  ...   
      '-----------------------------------------
      ' Function status
      '-----------------------------------------

      Dim eFunctionStatus As CatPspIDLFunctionStatus 
      eFunctionStatus = objPspFuncArg.FunctionStatus
  ...

[Top]


In Short

This use case how to obtain integration data from function, physical and spatial objects using a macro. 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.