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:
PrologThe 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 ObjectUsing 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 ObjectIt 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 InformationThis 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 InformationThis 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:
...
'--------------------------
' Check if the function object IsSpecDriven
bIsSpecDriven = objPspFuncArg.IsSpecDriven
...
'-------------------------------------------------------
' Check if Function object is associated with a placed
' physial part
bIsRealized = objPspFuncArg.IsRealized
...
...
'-----------------------------------------
' Get Compatible part types
'-----------------------------------------
Set objLStrCompPartTypes = objPspFuncArg.GetCompatiblePartTypes (strStdName)
If ( Not ( objLStrCompPartTypes Is Nothing ) ) Then
...
... Set objLPhysicals = objPspFuncArg.Physicals
If ( Not ( objLPhysicals Is Nothing ) ) Then
...
...
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
...
...
'-----------------------------------------
' Get Catalog Part name of the associated physical object
'-----------------------------------------
strCatalogPartName= objPspFuncArg.CatalogPartName
...
...
'-----------------------------------------
' Check if the associated Physical object is OK to integrate
'-----------------------------------------
bIsOkToIntegrate = objPspFuncArg.IsOKToIntegrate
...
...
'-----------------------------------------
' Function status
'-----------------------------------------
Dim eFunctionStatus As CatPspIDLFunctionStatus
eFunctionStatus = objPspFuncArg.FunctionStatus
...
|
[Top]
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]
| [1] | Replaying a macro |
| [Top] | |
Copyright © 2004, Dassault Systèmes. All rights reserved.