Distributive Systems |
Querying Stretchable Data |
|
This use case is intended to show you how to obtain data of a stretchable object using a macro. This macro opens the document CAAPsp3DEduIn.CATProduct. Using the root node of the document, it then finds a Stretchable object with a given instance name and to get Stretchable data. |
|
|
CAAPspStretchableData is launched in CATIA [1]. No open document is needed. CAAPspStretchableData.CATScript is located in the CAAScdPspUseCases module. Execute macro (windows only). |
|
|
CAAPspStretchableData includes the following steps: PrologThe macro first loads Distributive System document CAAPsp3DEduIn.CATProduct containing Equipment and Piping Design objects. Note: To open a different document, modify the variable sDocPath to point to the document 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\CAAPsp3DEduIn.CATProduct" )
Set objPspDoc = CATIA.Documents.Open(sDocFullPath)
...
Next, the macro acquires the PspWorkbench object from the document. The PspWorkbench is the top node of the object instance tree in a Distributive System application document. ...
' ---------------
' Find the top node of the Distributive System object tree - .
If ( Not ( objPspDoc Is Nothing ) ) Then
'Set objPrdRoot = objPspDoc.Product
Set objPrdRoot = CATIA.ActiveDocument.Product
If ( Not ( objPrdRoot Is Nothing ) ) Then
Set objPspWorkbench = objPrdRoot.GetTechnologicalObject ("PspWorkbench")
End If
End If
...
Get a PspStretchable ObjectUsing the objPrdRoot as the node, navigate through the Products collection to get a product whose instance name is P-074. Then use GetInteraface method of objPspWorkbench to get PspStretchableData object corresponding to the bendable pipe. ...
Dim objBendablePipe As Product
Dim objPspStretchableData As PspStretchableData
If ( Not ( objPspWorkbench Is Nothing ) And _
Not ( objPrdRoot Is Nothing ) ) Then
Set objBendablePipe = objPrdRoot.Products.Item("P-074")
Set objPspStretchableData = objPspWorkbench.GetInterface("CATIAPspStretchableData", _
objBendablePipe )
End If '--- If ( Not ( objPspWorkbench Is Nothing ) and objPspApplication
...
Get Definition PointsMacro calls ListDefinitionPoints method of PspStretchableData object (objPspStretchableData) to get a list of definition points. objLDefPoints is a collection object of the type PspListOfDoubles . Here objLDefPoints represents a list of X-Y-Z coordinates of the points such that there are doubles values per point. ...
Set objLDefPoints = objPspStretchableData.ListDefinitionPoints ( _
objRelAxisPrd )
'-----------------------------------------
' Display information on Definition points
'-----------------------------------------
If ( Not ( objLDefPoints Is Nothing ) ) Then
iNbPts = objLDefPoints.Count / 3
strMessage_g = strMessage_g & _
"Number of definition points =" & iNbPts & vbCr
For intIdx = 1 To objLDefPoints.Count Step 3
dbX = objLDefPoints.Item( intIdx )
dbY = objLDefPoints.Item( intIdx + 1 )
dbX = objLDefPoints.Item( intIdx + 2 )
strMessage_g = strMessage_g & "Definition pt " & vbCr
strMessage_g = strMessage_g & " X= " & dbX & vbCr
strMessage_g = strMessage_g & " Y= " & dbY & vbCr
strMessage_g = strMessage_g & " Z= " & dbZ & vbCr
Next
...
Get Bendable Radii InformationMacros calls ListBendData property of PspStretchableData object to retrieve bendable radii information as objLBendRadii. ...
Set objLBendRadii = objPspStretchableData.ListBendData
'-----------------------------------------
' Display Bend radii information
'-----------------------------------------
If ( Not ( objLBendRadii Is Nothing ) ) Then
iNbPts = objLDefPoints.Count / 3
strMessage_g = strMessage_g & _
"Number of bend radii =" & objLBendRadii.Count & vbCr
For intIdx = 1 To objLBendRadii.Count
dbRadius = objLBendRadii.Item( intIdx )
strMessage_g = strMessage_g & _
" Bend radius = " & dbRadius & vbCr
Next
End If
...
|
[Top]
This use case shows how to how to obtain data of a stretchable object 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.