Distributive Systems |
Delete Part |
![]() |
This use case is intended to show you how to delete a Group part object and then a Logical line object. This macro opens the document CAAPsp3DEduIn.CATProduct. Using the root node of the document, it initializes the Piping application, creates a Group and a Line object and then deletes them. |
![]() |
CAAPspDeletePart is launched in CATIA [1]. No open document is needed. CAAPspDeletePart.CATScript is located in the CAAScdPspUseCases module. Execute macro (windows only). |
![]() |
CAAPspLogicalLine 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\CAAPspEduIn.CATProduct") If (CATIA.FileSystem.FileExists(sDocFullPath) = False) then MsgBox sDocFullPath & " doesn't exist" Exit Sub End IF strMessage_g = sDocFullPath 'MsgBox strMessage_g 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 (PspWorkbench) of the Distributive System object tree - . If ( Not ( objPspDoc Is Nothing ) ) Then Set objPrdRoot = objPspDoc.Product If ( Not ( objPrdRoot Is Nothing ) ) Then Set objPspWorkbench = objPrdRoot.GetTechnologicalObject ("PspWorkbench") End If End If ... Initialize Piping ApplicationFrom the objPspWorkbench object, following objects can be obtained.
... If ( Not ( objPspWorkbench Is Nothing ) ) Then Set objPspApplication = objPspWorkbench.GetApplication(catPspIDLCATPiping) If ( Not(objPspApplication Is Nothing) ) Then strMessage_g = strMessage_g & "Success in getting objPspApplication" _ & vbCr objPspApplication.Initialization() End If End If '--- If ( Not ( objPspWorkbench Is Nothing )... ... If ( Not ( objPspWorkbench Is Nothing ) And _ Not ( objPspApplication Is Nothing ) ) Then Dim objLGroups As PspListOfObjects Dim objPspGroup As PspGroup Set objPspAppFactory = objPspWorkbench.GetInterface( _ "CATIAPspAppFactory", objPspApplication ) ... Create GroupIt then uses Application factory object objPspAppFactory to create a Group object objPspGroup by calling its CreateGroup function. CreateGroup function takes in GroupType and the Group ID of the object as the input parameters and returns the created Group object as the output. ... If ( Not ( objPspAppFactory Is Nothing ) ) Then Dim strGroupType As String Dim strGroupID As String strGroupType = "CATPipSpool" strGroupID = "PipingSpoolID" Set objPspGroup = objPspAppFactory.CreateGroup (objPrdRoot, _ strGroupType, strGroupID) ... Delete Group ObjectMacro uses Application factory object objPspAppFactory is to delete the Group object objPspGroup by calling its DeleteGroup function. ... '------------------------------------------- ' Delete group If ( Not (objPspGroup Is Nothing) ) Then objPspAppFactory.DeleteGroup objPspGroup strMessage_g = strMessage_g & "Deleted Group successfully :" _ & strGroupID & vbCr End If ... Create Logical Line InstanceMacro uses Application factory object objPspAppFactory to create a Logical Line object objPspLogLine by calling its GetLogicalLine() function. GetLogicalLine function takes in the Line ID of the object as the input parameter and returns the created Logical Line instance as the output. ... strLineID = "U1-P103-6in-CS150R-FG" ' --------------------- ' Create line instance Set objPspLogLine = objPspAppFactory.GetLogicalLine (objPrdRoot, _ strLineID ) If ( Not (objPspLogLine Is Nothing) ) Then strMessage_g = strMessage_g & "Create logical line instance ID = " _ & strLineID & vbCr End If ... Delete Logical Line InstanceMacro uses Application factory object objPspAppFactory is to delete the Line object objPspLogLine by calling its DeleteLogicalLine function. ... '------------------------------------------- ' Delete Line '------------------------------------------- If ( Not (objPspLogLine Is Nothing) ) Then objPspAppFactory.DeleteLogicalLine objPspLogLine strMessage_g = strMessage_g & "Deleted Line successfully :" & _ strLineID & vbCr End If ... |
[Top]
This use case shows how to delete a group part object . 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.