Distributive Systems |
Accessing Part Connector Data |
![]() |
This use case is intended to show you how to obtain physical part's technological connectors, add and remove a technological part connector to a physical part, and query the connectors information. 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 parts connector information |
![]() |
CAAPspPart is launched in CATIA [1]. No open document is needed. CAAPspPart.CATScript is located in the CAAScdPspUseCases module. Execute macro (windows only). |
![]() |
CAAPspPart 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 - . If ( Not ( objPspDoc Is Nothing ) ) Then Set objPrdRoot = objPspDoc.Product If ( Not ( objPrdRoot Is Nothing ) ) Then Set objPspWorkbench = objPrdRoot.GetTechnologicalObject ("PspWorkbench") ... 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) If ( objPspApplication Is Nothing ) Then strMessage_g = strMessage_g & "Success in getting objPspApplication" & vbCr objPspApplication.Initialization() ... Next, the macro acquires the PspAppFactory object objPspAppFactory on the application object. ... If ( Not ( objPspWorkbench Is Nothing ) And _ Not ( objPspApplication Is Nothing ) ) Then Dim objLPhysicals As PspListOfObjects Set objPspAppFactory = objPspWorkbench.GetInterface("CATIAPspAppFactory", _ 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 CATIAPspPhysicalProduct interface handle on the object ... Set objLPhysicals = objPspAppFactory.ListPhysicals ( objPrdRoot , catPspIDLCATPIP) If ( Not ( objLPhysicals Is Nothing ) And _ ( objLPhysicals.Count > 0 ) ) Then Set objPspPhysicalPrd = objLPhysicals.Item( 1, "CATIAPspPhysicalProduct" ) ... Get a List of Part connectorsObject objPspPhysicalPrd is used to get the list of technological connectors belonging to the physical part. For this it uses the property Connectors to get a list as objLCntrs . It then gets number of technological connectors. ... Set objLCntrs = objPspPhysicalPrd.Connectors If ( Not ( objLCntrs Is Nothing ) ) Then strMessage_g = strMessage_g & _ "Number of Part Connectors= " & objLCntrs.Count & vbCr ... It then uses the first connector object in the list objLCntrs and obtains a CATIAPspPartConnector interface handle on the connector and stores under the variable objPspPartCntr . ... '---------------------------------------- ' Getting the first PspPartConnector Set objPspPartCntr = objLCntrs.Item (1, "CATIAPspPartConnector") ... Retrieving Part Connector InformationThe objPspPartCntr is used to get the following part connector information:
... Set objFaceCntr = objPspPartCntr.GetFaceConnector Set objAlignCntr = objPspPartCntr.GetAlignmentConnector Set objOrientnCntr = objPspPartCntr.GetOrientationConnector eFaceType = objPspPartCntr.FaceType eAlignType = objPspPartCntr.AlignType eClockType = objPspPartCntr.ClockType Set objRelAxisPrd = Nothing Set objLDbPosition = objPspPartCntr.GetPosition (objRelAxisPrd) Set objLDbAlignDir = objPspPartCntr.GetAlignmentDirection( _ objRelAxisPrd) Set objLDbUpDir = objPspPartCntr.GetUpDirection (objRelAxisPrd) Set objLDbMathPlane = objPspPartCntr.GetConnectorMathPlane( _ objRelAxisPrd ) ... ... Add a Part ConnectorThis macro then add a part connector (technological connector) on the object objPspPhysicalPrd by calling its AddConnector function. Newly created connector is stored under the variable objNewPspPartCntr ... objNewPspPartCntr = objPspPhysicalPrd.AddConnector( _ strCtrType, objFaceCntr,eFaceType, _ objAlignCntr, eAlignType, _ objOrientnCntr, eClockType ) ... ' ----------------------------------- ' Add a new connector ' ----------------------------------- Dim objNewPspPartCntr As PspPartConnector If( Not ( objPspPhysicalPrd Is Nothing )) Then Dim strCtrType As String strCtrType = "CATPspMechPartConnector" Set objNewPspPartCntr = objPspPhysicalPrd.AddConnector( _ strCtrType, objFaceCntr,eFaceType, _ objAlignCntr, eAlignType, _ objOrientnCntr, eClockType ) ... Remove a Part ConnectorThis macro then removes the part connector (technological connector) objNewPspPartCntr on the object objPspPhysicalPrd by calling its RemoveConnector method. ... ' ----------------------------------- ' Remove connector ' ----------------------------------- If( Not ( objPspPhysicalPrd Is Nothing )) Then objPspPhysicalPrd.RemoveConnector objPspPartCntr End if ... |
[Top]
This use case is intended to show you how to obtain physical part's connectors, add and remove a part connector to a physical part, and query the connectors. 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.