Equipment & Systems |
Distributive Systems |
Placing PartsHow to place parts. |
Use Case |
This article discusses the CAACloPlacePart use case.
CAACloPlacePart is a use case of the CAACommonLayoutItf.edu framework. It illustrates a CATPlantShipInterfaces interface that is implemented by CATCommonLayout.
[Top]
This use case is intended to show you how to place parts using the CATIPspPlacePartOnRun interface.
[Top]
CAACloPlacePart places tubing parts. It places a valve and tube in space. It also places parts on run segments, run nodes and part connectors.
[Top]
To launch CAACloPlacePart, you will need to set up the build time environment, then compile CAACloPlacePart along with its prerequisites, set up the run time environment, and then execute the sample. This is fully described in the referenced article [1].
Launch the use case with the following command.
[Top]
The CAACloPlacePart code consists of three files located in the CAACloPlacePart.m use case module of the CAACommonLayoutItf.edu framework:
InstallRootDirectory
is the root directory of your CAA V5 installation1.
This sample uses two C++ source files: CAACloPlacePartMain.cpp and CAACloPlacePart.cpp. CAACloPlacePartMain.cpp holds the main method which initiates the sample code. CAACloPlacePart.cpp defines the class that places parts. CAACloPlacePart has a corresponding header (.h) file.
The CAACloPlacePart also uses three data files:
CAACloEduRuns.CATProduct is the main data model for the use cases. It is the file which should be referenced in the execution command line. CATTubTubingLine20010507183018970.CATProduct and TubingWP.CATProduct are used by CAACloEduRuns.CATProduct.
[Top]
The remainder of this document describes the various parts of CAACloPlacePartMain.cpp and CAACloPlacePart.cpp.
[Top]
CAACloPlacePartMain.cpp contains the main method that initiates processing. It reads the command line argument to find the path of the data file to be processed. It also creates the CAACloPlacePart class and calls the DoSample method of CAACloPlacePart.
// COPYRIGHT DASSAULT SYSTEMES 2008 //============================================================================= // // CAACloPlacePartMain // // This sample illustrates how to use the CAA Plant Ship interfaces to place parts. // // // Prerequisite: // ------------------- // This sample uses the input drawing CAACloEduRuns.CATProduct. // // Running the program: // ------------------- // To run this program, you can use the command: // // CAACloPlacePart MyRootDirectory/CAACommonLayoutItf.edu/CNext/resources/graphic/CAACloEduRuns/CAACloEduRuns.CATProduct // // where MyRootDirectory is the pathname of the root directory where you copied and built the use case. // //============================================================================= // #include <iostream.h> #include <string.h> // This framework #include "CAACloPlacePart.h" // System #include "CATErrorMacros.h" #include "CATUnicodeString.h" //============================================================================= // Main //============================================================================= int main (int argc, char **argv) { cout << "Start main CAACloPlacePart" << endl; int rc = 0; HRESULT rcError = CATReturnFailure; CATUnicodeString FileToBeLoaded = NULL; CAACloPlacePart myObject; CATTry { if (argc > 1) { FileToBeLoaded = argv[1]; } if (FileToBeLoaded.IsNull()) { cout << "**** must input the file name of " << endl; cout << "a CATProduct with Piping application objects " << endl; } else { cout << "FileToBeLoaded = " << FileToBeLoaded << endl; rcError = myObject.DoSample(FileToBeLoaded); } } CATCatch (CATError, pError) { cout << "error in main " << endl; rcError = CATReturnError(pError); } // end CATCatch CATEndTry; cout << "CAACloPlacePart rcError = " << rcError << endl; if (FAILED(rcError)) { rc = 999; CATError *pError = CATError::CATGetLastError(rcError); if (pError) { cout << pError; Flush(pError); } } cout << "CAACloPlacePart rc = " << rc << endl; cout << "End main CAACloPlacePart" << endl; return rc; }
[Top]
The CAACloPlacePart DoSample method runs the use cases. It starts by calling CreateCATProductEnv to load the input data model and create a CATIA product enviroment. CreateCATProductEnv is part of the CAAPspBaseEnvProtected class which is defined in these files.
//============================================================================= // Execute the CAACloPlacePart sample code. //============================================================================= HRESULT CAACloPlacePart::DoSample(const CATUnicodeString &iuFileToBeLoaded) { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::DoSample ==="<< endl; cout <<"============================================================"<< endl; cout <<" File: " << iuFileToBeLoaded << endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATTry { // Load input document CreateCATProductEnv(iuFileToBeLoaded); cout << "Product environment created." << endl; // Initialize Tubing Design application ApplicationInit("CATTubing"); cout << "Tubing application initialized." << endl; // Place a part in space. HRESULT rcSpace = PlacePartInSpace(); cout << "rcSpace = " << rcSpace << endl; // Route a string in space. HRESULT rcStringInSpace = RouteStringPartInSpace(); cout << "rcStringInSpace = " << rcStringInSpace << endl; // Place parts on run segments. HRESULT rcSegment = PlacePartOnRunSegment(); cout << "rcSegment = " << rcSegment << endl; // Place parts on run nodes. HRESULT rcNode = PlacePartOnRunNode(); cout << "rcNode = " << rcNode << endl; // Place parts on part conntectors. HRESULT rcPartCtr = PlacePartOnPartConnector(); cout << "rcPartCtr = " << rcPartCtr << endl; // Set return code. if (SUCCEEDED(rcSpace) && SUCCEEDED(rcStringInSpace) && SUCCEEDED(rcSegment) && SUCCEEDED(rcNode) && SUCCEEDED(rcPartCtr) ) rc = CATReturnSuccess; } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::DoSample *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; cout << "CAACloPlacePart::DoSample rc = " << rc << endl; return rc; }
[Top]
The CAACloPlacePart has several methods that support the use scenario.
//============================================================================= // Get a part connector. //============================================================================= HRESULT CAACloPlacePart::GetPartConnector(const IUnknown *ipiPartUnk, const int &iConnectorNumber, IUnknown *&opiPartConnector) { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::GetPartConnector ==="<< endl; cout <<"============================================================"<< endl; cout <<" Part: " << ipiPartUnk << ": " << GetObjectName(ipiPartUnk) << endl; cout <<" Connector number " << iConnectorNumber << endl; opiPartConnector = NULL; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATIPspPhysicalProduct *piPhysProd = NULL; CATIUnknownList *piListCtrs = NULL; int NumOfCtrs = 0; unsigned int ListSize = 0; CATTry { if (ipiPartUnk && SUCCEEDED(((IUnknown*)ipiPartUnk)->QueryInterface(IID_CATIPspPhysicalProduct,(void**)&piPhysProd))) { //---------------------------------------------------------------------- // List part connectors //---------------------------------------------------------------------- if ( SUCCEEDED(piPhysProd->ListConnectors(NULL,&piListCtrs)) && NULL != piListCtrs ) { // Get list of part connectors if ( SUCCEEDED(piListCtrs->Count(&ListSize)) ) NumOfCtrs = ListSize; cout << "Number of connectors on part: " << NumOfCtrs << endl; if (0 < iConnectorNumber && NumOfCtrs >= iConnectorNumber) { rc = piListCtrs->Item(iConnectorNumber-1,&opiPartConnector); } // End if valid ctr number. } // End if valid list of part ctrs. } // End if valid input part. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::GetPartConnector *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piPhysProd) {piPhysProd->Release(); piPhysProd = NULL;} if (piListCtrs) {piListCtrs->Release(); piListCtrs = NULL;} cout <<" opiPartConnector = " << opiPartConnector << endl; cout << "CAACloPlacePart::GetPartConnector rc = " << rc << endl; return rc; } //============================================================================= // Get location data for a part connector. //============================================================================= HRESULT CAACloPlacePart::GetPartConnectorData(const IUnknown *ipiPartUnk, const int &iConnectorNumber, IUnknown *ipiRelAxisUnk, CATMathPoint &oCtrPosition, CATMathDirection &oCtrAlign, CATMathDirection &oCtrUp) { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::GetPartConnectorData ==="<< endl; cout <<"============================================================"<< endl; cout <<" Part: " << ipiPartUnk << ": " << GetObjectName(ipiPartUnk) << endl; cout <<" Connector number " << iConnectorNumber << endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATIMovable *piRelAxis = NULL; IUnknown *piCtrUnk = NULL; CATIPspPartConnector *piPartCntr = NULL; CATTry { rc = GetPartConnector(ipiPartUnk, iConnectorNumber, piCtrUnk); if (SUCCEEDED(rc) && piCtrUnk) { if (ipiRelAxisUnk) ((IUnknown*)ipiRelAxisUnk)->QueryInterface(IID_CATIMovable,(void**)&piRelAxis); cout << "piRelAxis = " << piRelAxis << endl; if (SUCCEEDED(piCtrUnk->QueryInterface(IID_CATIPspPartConnector,(void**)&piPartCntr))) { rc = CATReturnSuccess; // Get connector position piPartCntr->GetPosition(piRelAxis,oCtrPosition); // Get connector alignment direction piPartCntr->GetAlignmentDirection(piRelAxis,oCtrAlign); // Get connector up direction piPartCntr->GetUpDirection(piRelAxis,oCtrUp); if (piPartCntr) {piPartCntr->Release(); piPartCntr = NULL;} } // End if valid part connector. if (piCtrUnk) {piCtrUnk->Release(); piCtrUnk = NULL;} } // End if valid part ctr. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::GetPartConnectorData *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piRelAxis) {piRelAxis->Release(); piRelAxis = NULL;} if (piCtrUnk) {piCtrUnk->Release(); piCtrUnk = NULL;} if (piPartCntr) {piPartCntr->Release(); piPartCntr = NULL;} cout << "oCtrPosition = " << oCtrPosition << endl; cout << "oCtrAlign = " << oCtrAlign << endl; cout << "oCtrUp = " << oCtrUp << endl; cout << "CAACloPlacePart::GetPartConnectorData rc = " << rc << endl; return rc; } //============================================================================= // Get part connected to a part ctr. //============================================================================= HRESULT CAACloPlacePart::GetConnectedPart(const IUnknown *ipiPartUnk, const int &iConnectorNumber, IUnknown *&opiConnectedCtr, IUnknown *&opiConnectedPart) { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::GetConnectedPart ==="<< endl; cout <<"============================================================"<< endl; cout <<" Part: " << ipiPartUnk << ": " << GetObjectName(ipiPartUnk) << endl; cout <<" Connector number " << iConnectorNumber << endl; opiConnectedCtr = NULL; opiConnectedPart = NULL; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. IUnknown *piCtrUnk = NULL; CATIPspConnection *piPspConnection = NULL; CATIPspConnector *piPspConnector = NULL; CATIUnknownList *piListConnections = NULL; IUnknown *piUnk = NULL; CATIUnknownList *piListCtr = NULL; CATIPspConnector *piPspConnectedCtr = NULL; CATIPspConnectable *piPspConnectedPart = NULL; CATTry { rc = GetPartConnector(ipiPartUnk, iConnectorNumber, piCtrUnk); if (SUCCEEDED(rc) && piCtrUnk) { // Get connected objects. if (SUCCEEDED(piCtrUnk->QueryInterface(IID_CATIPspConnector,(void**)&piPspConnector))) { if ( SUCCEEDED(piPspConnector->ListConnections (NULL, &piListConnections)) && piListConnections ) { cout << "piListConnections = " << piListConnections << endl; // Get a connection unsigned int numCnx = 0; piListConnections->Count(&numCnx); for ( unsigned int iiCnx = 0; iiCnx < numCnx; iiCnx++ ) { if ( SUCCEEDED(piListConnections->Item(iiCnx,&piUnk)) && (NULL != piUnk) ) { piUnk->QueryInterface(IID_CATIPspConnection,(void**)&piPspConnection); cout << "piPspConnection = " << piPspConnection << endl; if (piUnk) {piUnk->Release(); piUnk = NULL;} if (piPspConnection && SUCCEEDED(piPspConnector->ListConnectedCntrs (piPspConnection, &piListCtr)) && piListCtr ) { unsigned int numCtr = 0; piListCtr->Count(&numCtr); for ( unsigned int iiCtr = 0; iiCtr < numCtr; iiCtr++ ) { if ( SUCCEEDED(piListCtr->Item(iiCtr,&piUnk)) && (NULL != piUnk) ) { piUnk->QueryInterface(IID_CATIPspConnector,(void**)&piPspConnectedCtr); cout << "piPspConnectedCtr = " << piPspConnectedCtr << endl; if (piUnk) {piUnk->Release(); piUnk = NULL;} if (piPspConnectedCtr) { piPspConnectedCtr->GetAssociatedConnectable(&piPspConnectedPart); cout << "piPspConnectedPart = " << piPspConnectedPart << endl; if (piPspConnectedPart) { piPspConnectedCtr->QueryInterface(IID_IUnknown,(void**)&opiConnectedCtr); piPspConnectedPart->QueryInterface(IID_IUnknown,(void**)&opiConnectedPart); break; } if (piPspConnectedCtr) {piPspConnectedCtr->Release(); piPspConnectedCtr = NULL;} if (piPspConnectedPart) {piPspConnectedPart->Release(); piPspConnectedPart = NULL;} } } // End if valid ctr list item. } // End loop on connected ctrs. if (piListCtr) {piListCtr->Release(); piListCtr = NULL;} } // End if valid list of ctrs. if (piPspConnection) {piPspConnection->Release(); piPspConnection = NULL;} } // End if valid cnx list item. } // End loop on connections. if (piListConnections) {piListConnections->Release(); piListConnections = NULL;} } // End if valid list of connections. } // End if valid psp ctr if (piCtrUnk) {piCtrUnk->Release(); piCtrUnk = NULL;} } // End if valid ctr. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::GetConnectedPart *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piCtrUnk) {piCtrUnk->Release(); piCtrUnk = NULL;} if (piPspConnection) {piPspConnection->Release(); piPspConnection = NULL;} if (piPspConnector) {piPspConnector->Release(); piPspConnector = NULL;} if (piListConnections) {piListConnections->Release(); piListConnections = NULL;} if (piUnk) {piUnk->Release(); piUnk = NULL;} if (piListCtr) {piListCtr->Release(); piListCtr = NULL;} if (piPspConnectedCtr) {piPspConnectedCtr->Release(); piPspConnectedCtr = NULL;} if (piPspConnectedPart) {piPspConnectedPart->Release(); piPspConnectedPart = NULL;} cout <<" opiConnectedCtr = " << opiConnectedCtr << endl; cout <<" opiConnectedPart = " << opiConnectedPart << endl; if (opiConnectedCtr && opiConnectedCtr) rc = CATReturnSuccess; cout << "CAACloPlacePart::GetConnectedPart rc = " << rc << endl; return rc; } #define PointTolerance 0.01 // mm int ArePointsEqual(const CATMathPoint &iPoint0, const CATMathPoint &iPoint1) { return (iPoint0.DistanceTo(iPoint1) <= PointTolerance); } int AreVectorsEqual(const CATMathVector &iVector0, const CATMathVector &iVector1) { return ArePointsEqual(CATMathO+iVector0, CATMathO+iVector1); } //============================================================================= // Test location data for a part connector. //============================================================================= HRESULT CAACloPlacePart::TestPartConnectorData(const IUnknown *ipiPartUnk, const int &iConnectorNumber, IUnknown *ipiRelAxisUnk, const CATMathPoint &iCtrPosition, const CATMathDirection &iCtrAlign, const CATMathDirection &iCtrUp) { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::TestPartConnectorData ==="<< endl; cout <<"============================================================"<< endl; cout <<" Part: " << ipiPartUnk << ": " << GetObjectName(ipiPartUnk) << endl; cout <<" Connector number " << iConnectorNumber << endl; cout << "iCtrPosition = " << iCtrPosition << endl; cout << "iCtrAlign = " << iCtrAlign << endl; cout << "iCtrUp = " << iCtrUp << endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATIMovable *piRelAxis = NULL; IUnknown *piCtrUnk = NULL; CATIPspPartConnector *piPartCntr = NULL; CATMathPoint ctrPosition; CATMathDirection ctrAlign; CATMathDirection ctrUp; CATTry { if (SUCCEEDED(GetPartConnectorData(ipiPartUnk, iConnectorNumber, ipiRelAxisUnk, ctrPosition, ctrAlign, ctrUp))) { cout << "ctrPosition = " << ctrPosition << endl; cout << "ctrAlign = " << ctrAlign << endl; cout << "ctrUp = " << ctrUp << endl; if (ArePointsEqual(ctrPosition, iCtrPosition) && AreVectorsEqual(ctrAlign, iCtrAlign) && AreVectorsEqual(ctrUp, ctrUp)) { rc = CATReturnSuccess; } } // End if get valid part ctr data succeeded. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::TestPartConnectorData *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piRelAxis) {piRelAxis->Release(); piRelAxis = NULL;} if (piCtrUnk) {piCtrUnk->Release(); piCtrUnk = NULL;} if (piPartCntr) {piPartCntr->Release(); piPartCntr = NULL;} cout << "CAACloPlacePart::TestPartConnectorData rc = " << rc << endl; return rc; } int AreObjectsEqual(const IUnknown *ipiObject0, const IUnknown *ipiObject1) { int rc = 0; IUnknown *piObjectUnk0 = NULL; IUnknown *piObjectUnk1 = NULL; if (ipiObject0 == ipiObject1) { rc = 1; } else if (!ipiObject0 || !ipiObject1) { rc = 0; } else if (SUCCEEDED(((IUnknown*)ipiObject0)->QueryInterface(IID_IUnknown,(void**)&piObjectUnk0)) && SUCCEEDED(((IUnknown*)ipiObject1)->QueryInterface(IID_IUnknown,(void**)&piObjectUnk1)) && piObjectUnk0 == piObjectUnk1) { rc = 1; } if (piObjectUnk0) {piObjectUnk0->Release(); piObjectUnk0 = NULL;} if (piObjectUnk1) {piObjectUnk1->Release(); piObjectUnk1 = NULL;} return rc; } //============================================================================= // Test part connected to a part ctr. //============================================================================= HRESULT CAACloPlacePart::TestConnectedPart(const IUnknown *ipiPartUnk, const int &iConnectorNumber, const IUnknown *ipiConnectedPart, const int &iConnectedConnectorNumber) { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::TestConnectedPart ==="<< endl; cout <<"============================================================"<< endl; cout <<" Part: " << ipiPartUnk << ": " << GetObjectName(ipiPartUnk) << endl; cout <<" Connector number " << iConnectorNumber << endl; cout <<" ipiConnectedPart = " << ipiConnectedPart << endl; cout <<" iConnectedConnectorNumber = " << iConnectedConnectorNumber << endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. IUnknown *piConnectedCtr = NULL; IUnknown *piConnectedPart = NULL; IUnknown *piConnectedCtrExpected = NULL; CATTry { if (SUCCEEDED(GetConnectedPart(ipiPartUnk, iConnectorNumber, piConnectedCtr, piConnectedPart)) && piConnectedCtr && piConnectedPart && AreObjectsEqual(piConnectedPart, ipiConnectedPart)) { cout <<" piConnectedCtr = " << piConnectedCtr << endl; if (SUCCEEDED(GetPartConnector(ipiConnectedPart, iConnectedConnectorNumber, piConnectedCtrExpected)) && piConnectedCtrExpected) { cout <<" piConnectedCtrExpected = " << piConnectedCtrExpected << endl; if (AreObjectsEqual(piConnectedCtr, piConnectedCtrExpected)) rc = CATReturnSuccess; } } // End if valid ctr. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::TestConnectedPart *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piConnectedCtr) {piConnectedCtr->Release(); piConnectedCtr = NULL;} if (piConnectedPart) {piConnectedPart->Release(); piConnectedPart = NULL;} if (piConnectedCtrExpected) {piConnectedCtrExpected->Release(); piConnectedCtrExpected = NULL;} cout << "CAACloPlacePart::TestConnectedPart rc = " << rc << endl; return rc; }
[Top]
CAACloPlacePart places a valve and a tube in space. The valve is placed by the method PlacePartInSpace. PlacePartInSpace first performs setup necessary for placing any part. It gets a tubing application object and derives a CATIPspPlacePartOnRun interface object from the application object. It calls GetChildObject to find the tubing work package (TubingWP.1) which is a child of the data model's root product. It finds the tubing line in TubingWP.1 using the method GetALogicalLine. Both GetChildObject and GetALogicalLine are part of CAAPspBaseEnvProtected.
After accomplishing it's setup duties PlacePartInSpace begins it's major work of placing a valve. The first step is to find the correct valve in the catalog. The CATIPspPlacePartOnRun method GetReferencePartFromCatalog is used to find a reference part in the catalog. GetReferencePartFromCatalog takes standard as an input to help decode attribute values. It also can accept a specification ("spec"). In the sample the spec is set to null so no specification is used. If spec is set the catalog search will be limited to parts that meet the given specification. Part type and part number are the key arguments that define the part which is being looked for. The parent product is also sent to GetReferencePartFromCatalog. This helps GetReferencePartFromCatalog decode various names more efficiently. The found reference product is returned in the last argument, piReferencePart.
The second part placement step is to position and properly connect an instance product in the data model. This is accomplished using PlacePartInSpace. PlacePartInSpace accepts the same standard for input as was used for GetReferencePartFromCatalog. It accepts a function type which tracks the purpose of the instance part. The reference part is sent to PlacePartInSpace to define the part being placed. The logical line defines the tubing line into which the new part will become a member. The new part ID can be specified. In the sample code the ID is null which instructs the part placement engine to generate the part ID according to it's preset rules. Up direction, horizontal orientation and position all define how the new part is positioned. The new instance part is returned in piInstancePart.
Once the new part is placed the PlacePartInSpace tests part connector data to ensure that the part is positioned correctly. Connector data is tested using the TestPartConnectorData method.
The code for PlacePartInSpace is shown below.
//============================================================================= // Place parts in space. //============================================================================= HRESULT CAACloPlacePart::PlacePartInSpace() { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::PlacePartInSpace ==="<< endl; cout <<"============================================================"<< endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATObject *piAppObject = NULL; CATIPspPlacePartOnRun *piPlacePart = NULL; IUnknown *piReferencePart = NULL; CATIProduct *piParentProduct = NULL; CATIPspLogicalLine *piLogicalLine = NULL; IUnknown *piInstancePart = NULL; CATUnicodeString uPlacePartErrorMessage; CATUnicodeString uStandard = "SSTL"; CATUnicodeString uSpecName = ""; CATUnicodeString uPartType; CATUnicodeString uPartNumber; CATUnicodeString uFunctionType; CATUnicodeString uPlacedPartID; CATMathDirection upDirection; CATMathDirection horizontalOrientation; CATMathPoint position; CATMathPoint ctrPosition; CATMathDirection ctrAlign; CATMathDirection ctrUp; CATTry { // Get application object. piAppObject = new CATObject("CATTubing"); cout << "piAppObject = " << piAppObject << endl; if (piAppObject && SUCCEEDED(piAppObject->QueryInterface(IID_CATIPspPlacePartOnRun,(void**)&piPlacePart))) { cout << "piPlacePart = " << piPlacePart << endl; piParentProduct = (CATIProduct*)GetChildObject(IID_CATIProduct, "TubingWP.1"); cout << "piParentProduct = " << piParentProduct << endl; piLogicalLine = GetALogicalLine(piParentProduct); cout << "piLogicalLine = " << piLogicalLine << endl; // Get reference part uPartType = "CATTubControlValve"; uPartNumber = "V_BALL-TF-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { // Place part in space. uFunctionType = "CATTubControlValveFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine upDirection.SetCoord(0, 0, 1); // Part up direction parallel to z-axis. horizontalOrientation.SetCoord(0,1,0); // Align part parallel to y-axis. position.SetCoord(1000,2000,4000); // Position part at (1000, 2000, 4000) in mm. rc = piPlacePart->PlacePartInSpace (uStandard, uFunctionType, piReferencePart, piParentProduct, piLogicalLine, uPlacedPartID, upDirection, horizontalOrientation, position, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(1014.61,2000,4000); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(985.395,2000,4000); ctrAlign.SetCoord(-1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } else { rc = CATReturnFailure; } } if (FAILED(rc)) { piPlacePart->GetErrorMessage(uPlacePartErrorMessage); cout << "uPlacePartErrorMessage = " << uPlacePartErrorMessage << endl; } } // End if valid place part object. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::PlacePartInSpace *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piAppObject) {piAppObject->Release(); piAppObject = NULL;} if (piPlacePart) {piPlacePart->Release(); piPlacePart = NULL;} if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piParentProduct) {piParentProduct->Release(); piParentProduct = NULL;} if (piLogicalLine) {piLogicalLine->Release(); piLogicalLine = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} cout << "CAACloPlacePart::PlacePartInSpace rc = " << rc << endl; return rc; }
After CAACloPlacePart places a valve in space it places a tube in space. The tube is placed by the method RouteStringPartInSpace. RouteStringPartInSpace is very similar to PlacePartInSpace. A minor difference is that RouteStringPartInSpace finds a tube in the catalog instead of a valve. Another relatively minor difference is that RouteStringPartInSpace sets an ID for the new part using the uPlacedPartID argument. The major difference is that RouteStringPartInSpace must define the tube node points and bend radii. The bend radii are defined with a list of double values that are interpretted as millimeter lengths. The tube node points are defined by creating a part and creating points in the new part. Connector data is tested using the TestPartConnectorData method.
The code for RouteStringPartInSpace is shown below.
//============================================================================= // Place string parts in space. //============================================================================= HRESULT CAACloPlacePart::RouteStringPartInSpace() { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::RouteStringPartInSpace ==="<< endl; cout <<"============================================================"<< endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATObject *piAppObject = NULL; CATIPspPlacePartOnRun *piPlacePart = NULL; IUnknown *piReferencePart = NULL; CATIProduct *piParentProduct = NULL; CATIPspLogicalLine *piLogicalLine = NULL; CATIUnknownList *piListPoints = NULL; IUnknown *piInstancePart = NULL; CATIAProducts *piParentProducts = NULL; CATIAProduct *piPartForPointsProduct = NULL; CATBaseDispatch *piPartForPointsShape = NULL; CATIAPartDocument *piPartForPointsDoc = NULL; CATIAPart *piPartForPoints = NULL; CATIAFactory *piShapeFactory = NULL; CATIAHybridShapeFactory *piHybridShapeFactory = NULL; CATIAHybridShapePointCoord *piPoint = NULL; CATIUnknownListImpl *piListImpl = NULL; CATUnicodeString uPlacePartErrorMessage; CATUnicodeString uStandard = "SSTL"; CATUnicodeString uSpecName = ""; CATUnicodeString uPartType; CATUnicodeString uPartNumber; CATUnicodeString uDocumentType; CATBSTR documentTypeBSTR; CATBSTR partNumberBSTR; CATUnicodeString uFunctionType; CATUnicodeString uPlacedPartID; CATMathDirection firstPointUpDirection; CATListOfDouble listBendRadii; CATMathPoint ctrPosition; CATMathDirection ctrAlign; CATMathDirection ctrUp; CATTry { // Get application object. piAppObject = new CATObject("CATTubing"); cout << "piAppObject = " << piAppObject << endl; if (piAppObject && SUCCEEDED(piAppObject->QueryInterface(IID_CATIPspPlacePartOnRun,(void**)&piPlacePart))) { cout << "piPlacePart = " << piPlacePart << endl; piParentProduct = (CATIProduct*)GetChildObject(IID_CATIProduct, "TubingWP.1"); cout << "piParentProduct = " << piParentProduct << endl; piLogicalLine = GetALogicalLine(piParentProduct); cout << "piLogicalLine = " << piLogicalLine << endl; // Get reference part uPartType = "CATTubBendableTube"; uPartNumber = "TUBE-BENDABLE-TIV-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { // Create points for bendable routing. if (piParentProduct && SUCCEEDED(piParentProduct->QueryInterface(IID_CATIAProducts,(void**)&piParentProducts))) { cout << "piParentProducts = " << piParentProducts << endl; // Create part to hold points. uDocumentType = "Part"; uDocumentType.ConvertToBSTR(&documentTypeBSTR); uPartNumber = "PartForPointsTubing"; uPartNumber.ConvertToBSTR(&partNumberBSTR); HRESULT rcPointsPart = piParentProducts->AddNewComponent(documentTypeBSTR, partNumberBSTR, piPartForPointsProduct); cout << "rcPointsPart = " << rcPointsPart << endl; cout << "piPartForPointsProduct = " << piPartForPointsProduct << endl; if (piPartForPointsProduct) { piPartForPointsProduct->GetMasterShapeRepresentation(TRUE, piPartForPointsShape); cout << "piPartForPointsShape = " << piPartForPointsShape << endl; if (piPartForPointsShape && SUCCEEDED(piPartForPointsShape->QueryInterface(IID_CATIAPartDocument,(void**)&piPartForPointsDoc))) { cout << "piPartForPointsDoc = " << piPartForPointsDoc << endl; piPartForPointsDoc->get_Part(piPartForPoints); cout << "piPartForPoints = " << piPartForPoints << endl; if (piPartForPoints) { piPartForPoints->get_HybridShapeFactory(piShapeFactory); if (piShapeFactory) piShapeFactory->QueryInterface(IID_CATIAHybridShapeFactory,(void**)&piHybridShapeFactory); cout << "piHybridShapeFactory = " << piHybridShapeFactory << endl; if (piHybridShapeFactory) { piListImpl = new CATIUnknownListImpl(); if (piListImpl) piListImpl->QueryInterface (IID_CATIUnknownList,(void**)&piListPoints); cout << "piListPoints = " << piListPoints << endl; if (piListPoints) { double points[4][3] = { {-1500.0, -1000.0, 0.0}, {-2500.0, -1000.0, 0.0}, {-2500.0, 500.0, 0.0}, {-3500.0, 500.0, 0.0} }; for (unsigned int iiPoint = 0; iiPoint < 4; iiPoint++) { cout << "iiPoint = " << iiPoint << endl; piHybridShapeFactory->AddNewPointCoord(points[iiPoint][0], points[iiPoint][1], points[iiPoint][2], piPoint); cout << "piPoint = " << piPoint << endl; piListPoints->Add(iiPoint, piPoint); if (piPoint) {piPoint->Release(); piPoint = NULL;} } // End loop on points. } // End valid list of points. } // End valid shape factory. } // End valid part for points. } // End valid shape. } // End valid part for points product. } // End valid parent product. // Place part in space. uFunctionType = "CATTubTubeFunction"; uPlacedPartID = "TestTubeWithBends"; firstPointUpDirection.SetCoord(0, 0, 1); // Up direction parallel to z-axis. listBendRadii.RemoveAll(); listBendRadii.Append(25.4); // Bend radius in mm (1in). listBendRadii.Append(25.4); listBendRadii.Append(25.4); listBendRadii.Append(25.4); rc = piPlacePart->RouteStringPartInSpace (uStandard, uFunctionType, piReferencePart, piParentProduct, piLogicalLine, uPlacedPartID, firstPointUpDirection, piListPoints, listBendRadii, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(-1500,-1000,0); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-3500,500,0); ctrAlign.SetCoord(-1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } else { rc = CATReturnFailure; } } if (FAILED(rc)) { piPlacePart->GetErrorMessage(uPlacePartErrorMessage); cout << "uPlacePartErrorMessage = " << uPlacePartErrorMessage << endl; } } // End if valid place part object. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::RouteStringPartInSpace *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piAppObject) {piAppObject->Release(); piAppObject = NULL;} if (piPlacePart) {piPlacePart->Release(); piPlacePart = NULL;} if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piParentProduct) {piParentProduct->Release(); piParentProduct = NULL;} if (piLogicalLine) {piLogicalLine->Release(); piLogicalLine = NULL;} if (piListPoints) {piListPoints->Release(); piListPoints = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} if (piParentProducts) {piParentProducts->Release(); piParentProducts = NULL;} if (piPartForPointsProduct) {piPartForPointsProduct->Release(); piPartForPointsProduct = NULL;} if (piPartForPointsShape) {piPartForPointsShape->Release(); piPartForPointsShape = NULL;} if (piPartForPointsDoc) {piPartForPointsDoc->Release(); piPartForPointsDoc = NULL;} if (piPartForPoints) {piPartForPoints->Release(); piPartForPoints = NULL;} if (piShapeFactory) {piShapeFactory->Release(); piShapeFactory = NULL;} if (piHybridShapeFactory) {piHybridShapeFactory->Release(); piHybridShapeFactory = NULL;} if (piPoint) {piPoint->Release(); piPoint = NULL;} if (piListImpl) {piListImpl->Release(); piListImpl = NULL;} cout << "CAACloPlacePart::RouteStringPartInSpace rc = " << rc << endl; return rc; }
[Top]
The CAACloPlacePart method PlacePartOnRunSegment places parts on run segments. PlacePartOnRunSegment performs the same setup as PlacePartInSpace. In addition it finds Run-0043, which is a child of TubingWP.1, using the GetChildObject. PlacePartOnRunSegment places a union and a tube two segments of Run-0043. The placement of the tube causes the union and tube to be connected.
Parts are placed on run segments using the CATIPspPlacePartOnRun method PlacePartOnRunSegment. The major change from placing a part in space is that a run segment is needed. The list of run segments is retrieved with CATIArrSegmentsString::ListSegments. The union is placed on the first segment and the tube is placed on the second segment. The run segment defines the part up direction and horizontal alignment. Position data is still sent to fix the parts position on the segment. Connector data is tested using the TestPartConnectorData method and the connection is tested with the TestConnectedPart method.
//============================================================================= // Place parts on run segments. //============================================================================= HRESULT CAACloPlacePart::PlacePartOnRunSegment() { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::PlacePartOnRunSegment ==="<< endl; cout <<"============================================================"<< endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATObject *piAppObject = NULL; CATIPspPlacePartOnRun *piPlacePart = NULL; CATIProduct *piParentProduct = NULL; CATIPspLogicalLine *piLogicalLine = NULL; CATIArrSegmentsString *piRun = NULL; IUnknown *piReferencePart = NULL; CATIArrSegment *piSegment = NULL; IUnknown *piInstancePart = NULL; IUnknown *piConnectedPart = NULL; IUnknown *piInstanceUnion = NULL; CATUnicodeString uPlacePartErrorMessage; CATListValCATBaseUnknown_var listOfSegments; CATUnicodeString uStandard = "SSTL"; CATUnicodeString uSpecName = ""; CATUnicodeString uPartType; CATUnicodeString uPartNumber; CATUnicodeString uFunctionType; CATUnicodeString uPlacedPartID; CATMathPoint position; CATMathPoint ctrPosition; CATMathDirection ctrAlign; CATMathDirection ctrUp; CATIArrSegment_var spSegment; CATTry { // Get application object. piAppObject = new CATObject("CATTubing"); cout << "piAppObject = " << piAppObject << endl; if (piAppObject && SUCCEEDED(piAppObject->QueryInterface(IID_CATIPspPlacePartOnRun,(void**)&piPlacePart))) { cout << "piPlacePart = " << piPlacePart << endl; piParentProduct = (CATIProduct*)GetChildObject(IID_CATIProduct, "TubingWP.1"); cout << "piParentProduct = " << piParentProduct << endl; //piLogicalLine = GetALogicalLine(piParentProduct); cout << "piLogicalLine = " << piLogicalLine << endl; piRun = (CATIArrSegmentsString*)GetChildObject(IID_CATIArrSegmentsString, "Run-0043", piParentProduct); cout << "piRun = " << piRun << endl; if (piRun) { piRun->ListSegments(listOfSegments); cout << "listOfSegments.Size() = " << listOfSegments.Size() << endl; do { // Dummy loop to allow easy exit on fail. // ============================================================================== // Place union on segment // ============================================================================== // Get reference part uPartType = "CATTubUnion"; uPartNumber = "UNION-BULKHEAD-FFSM-16"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { if (listOfSegments.Size() >= 1) { spSegment = listOfSegments[1]; if (!!spSegment) spSegment->QueryInterface(IID_CATIArrSegment,(void**)&piSegment); cout << "piSegment = " << piSegment << endl; } if (piSegment) { // Place part on run segment. uFunctionType = "CATTubTubeFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine position.SetCoord(-200,-800,0); // in mm. rc = piPlacePart->PlacePartOnRunSegment (uStandard, uFunctionType, piReferencePart, piSegment, piLogicalLine, uPlacedPartID, position, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { piInstancePart->QueryInterface(IID_IUnknown,(void**)&piInstanceUnion); // Test part connectors. ctrPosition.SetCoord(-171.006,-800,0); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-228.994,-800,0); ctrAlign.SetCoord(-1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } else { rc = CATReturnFailure; } } // End if valid segment. } // End if valid reference part. if (FAILED(rc)) break; if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piSegment) {piSegment->Release(); piSegment = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} // ============================================================================== // Place bendable on segment // ============================================================================== // Get reference part uPartType = "CATTubBendableTube"; uPartNumber = "TUBE-BENDABLE-TIV-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { if (listOfSegments.Size() >= 2) { spSegment = listOfSegments[2]; if (!!spSegment) spSegment->QueryInterface(IID_CATIArrSegment,(void**)&piSegment); cout << "piSegment = " << piSegment << endl; } if (piSegment) { // Place part on run segment. uFunctionType = "CATTubTubeFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine position.SetCoord(-800,-600,0); // in mm. rc = piPlacePart->PlacePartOnRunSegment (uStandard, uFunctionType, piReferencePart, piSegment, piLogicalLine, uPlacedPartID, position, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(-228.994,-800,0); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { rc = TestConnectedPart(piInstancePart, 1, piInstanceUnion, 2); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-1600,-1500,0); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } // End if connected part test succeeded. } // End if ctr 1 test succeeded. } // End if valid instance part. else { rc = CATReturnFailure; } } // End if valid segment. } // End if valid reference part. } while (0); // End dummy loop for easy exit on fail. } // End if valid run. if (FAILED(rc)) { piPlacePart->GetErrorMessage(uPlacePartErrorMessage); cout << "uPlacePartErrorMessage = " << uPlacePartErrorMessage << endl; } } // End if valid place part object. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::PlacePartOnRunSegment *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piAppObject) {piAppObject->Release(); piAppObject = NULL;} if (piPlacePart) {piPlacePart->Release(); piPlacePart = NULL;} if (piParentProduct) {piParentProduct->Release(); piParentProduct = NULL;} if (piLogicalLine) {piLogicalLine->Release(); piLogicalLine = NULL;} if (piRun) {piRun->Release(); piRun = NULL;} if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piSegment) {piSegment->Release(); piSegment = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} if (piConnectedPart) {piConnectedPart->Release(); piConnectedPart = NULL;} if (piInstanceUnion) {piInstanceUnion->Release(); piInstanceUnion = NULL;} cout << "CAACloPlacePart::PlacePartOnRunSegment rc = " << rc << endl; return rc; }
[Top]
The CAACloPlacePart method PlacePartOnRunNode places parts on run nodes. Again setup is very similar to previous methods. Run-044 is used for part placement. CATIArrSegmentsString::ListNodes finds the run nodes. A valve is placed on the first node which is an extremity (or exterior) node at the beginning of the run. An elbow is placed on the fifth node which is interior or a corner. A bendable tube is placed placed on the second node. It expands to meet the valve and the union and is connected to them. The nodes are the only position data needed since they provide location and the connected segments provide up direction and horizontal orientation. Connector data is tested using the TestPartConnectorData method and the connections are tested with the TestConnectedPart method.
//============================================================================= // Place parts on run nodes. //============================================================================= HRESULT CAACloPlacePart::PlacePartOnRunNode() { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::PlacePartOnRunNode ==="<< endl; cout <<"============================================================"<< endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATObject *piAppObject = NULL; CATIPspPlacePartOnRun *piPlacePart = NULL; CATIProduct *piParentProduct = NULL; CATIPspLogicalLine *piLogicalLine = NULL; CATIArrSegmentsString *piRun = NULL; IUnknown *piReferencePart = NULL; CATIArrNode *piNode = NULL; IUnknown *piInstancePart = NULL; IUnknown *piConnectedPart = NULL; IUnknown *piInstanceValve = NULL; IUnknown *piInstanceElbow = NULL; CATUnicodeString uPlacePartErrorMessage; CATListValCATBaseUnknown_var listOfNodes; CATUnicodeString uStandard = "SSTL"; CATUnicodeString uSpecName = ""; CATUnicodeString uPartType; CATUnicodeString uPartNumber; CATUnicodeString uFunctionType; CATUnicodeString uPlacedPartID; CATMathPoint ctrPosition; CATMathDirection ctrAlign; CATMathDirection ctrUp; CATIArrNode_var spNode; CATTry { // Get application object. piAppObject = new CATObject("CATTubing"); cout << "piAppObject = " << piAppObject << endl; if (piAppObject && SUCCEEDED(piAppObject->QueryInterface(IID_CATIPspPlacePartOnRun,(void**)&piPlacePart))) { cout << "piPlacePart = " << piPlacePart << endl; piParentProduct = (CATIProduct*)GetChildObject(IID_CATIProduct, "TubingWP.1"); cout << "piParentProduct = " << piParentProduct << endl; //piLogicalLine = GetALogicalLine(piParentProduct); cout << "piLogicalLine = " << piLogicalLine << endl; piRun = (CATIArrSegmentsString*)GetChildObject(IID_CATIArrSegmentsString, "Run-0044", piParentProduct); cout << "piRun = " << piRun << endl; if (piRun) { piRun->ListNodes(listOfNodes); cout << "listOfNodes.Size() = " << listOfNodes.Size() << endl; do { // Dummy loop to allow easy exit on fail. // ============================================================================== // Place valve on exterior node // ============================================================================== // Get reference part uPartType = "CATTubControlValve"; uPartNumber = "V_BALL-TF-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { if (listOfNodes.Size() >= 1) { spNode = listOfNodes[1]; if (!!spNode) spNode->QueryInterface(IID_CATIArrNode,(void**)&piNode); cout << "piNode = " << piNode << endl; } if (piNode) { uFunctionType = "CATTubControlValveFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine rc = piPlacePart->PlacePartOnRunNode(uStandard, uFunctionType, piReferencePart, piNode, piLogicalLine, uPlacedPartID, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { piInstancePart->QueryInterface(IID_IUnknown,(void**)&piInstanceValve); // Test part connectors. ctrPosition.SetCoord(-500,800,0); ctrAlign.SetCoord(-1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-470.79,800,0); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } else { rc = CATReturnFailure; } } // End if valid segment. } // End if valid reference part. if (FAILED(rc)) break; if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piNode) {piNode->Release(); piNode = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} // ============================================================================== // Place elbow on interior node. // ============================================================================== // Get reference part uPartType = "CATTubNonReducingElbow"; uPartNumber = "ELBOW-90-BULKHEAD-FFSM-16"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { if (listOfNodes.Size() >= 5) { spNode = listOfNodes[5]; if (!!spNode) spNode->QueryInterface(IID_CATIArrNode,(void**)&piNode); cout << "piNode = " << piNode << endl; } if (piNode) { uFunctionType = "CATTubTubeFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine rc = piPlacePart->PlacePartOnRunNode(uStandard, uFunctionType, piReferencePart, piNode, piLogicalLine, uPlacedPartID, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { piInstancePart->QueryInterface(IID_IUnknown,(void**)&piInstanceElbow); // Test part connectors. ctrPosition.SetCoord(-741.3,2000,1800); ctrAlign.SetCoord(-1,0,0); ctrUp.SetCoord(0,0,-1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-700,2063.53,1800); ctrAlign.SetCoord(0,1,0); ctrUp.SetCoord(0,0,-1); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } else { rc = CATReturnFailure; } } // End if valid segment. } // End if valid reference part. if (FAILED(rc)) break; if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piNode) {piNode->Release(); piNode = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} // ============================================================================== // Place bendable on node. // ============================================================================== // Get reference part uPartType = "CATTubBendableTube"; uPartNumber = "TUBE-BENDABLE-TIV-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { if (listOfNodes.Size() >= 2) { spNode = listOfNodes[2]; if (!!spNode) spNode->QueryInterface(IID_CATIArrNode,(void**)&piNode); cout << "piNode = " << piNode << endl; } if (piNode) { uFunctionType = "CATTubTubeFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine rc = piPlacePart->PlacePartOnRunNode(uStandard, uFunctionType, piReferencePart, piNode, piLogicalLine, uPlacedPartID, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(-500,800,0); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { rc = TestConnectedPart(piInstancePart, 1, piInstanceValve, 1); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-741.3,2000,1800); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,-1,0); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { rc = TestConnectedPart(piInstancePart, 2, piInstanceElbow, 1); } // End if part ctr 2 test succeeded. } // End if part ctr 1 connected part test succeeded } // End if part ctr 1 test succeeded. } else { rc = CATReturnFailure; } } // End if valid segment. } // End if valid reference part. } while (0); // End dummy loop for easy exit on fail. } // End if valid run. if (FAILED(rc)) { piPlacePart->GetErrorMessage(uPlacePartErrorMessage); cout << "uPlacePartErrorMessage = " << uPlacePartErrorMessage << endl; } } // End if valid place part object. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::PlacePartOnRunNode *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piAppObject) {piAppObject->Release(); piAppObject = NULL;} if (piPlacePart) {piPlacePart->Release(); piPlacePart = NULL;} if (piParentProduct) {piParentProduct->Release(); piParentProduct = NULL;} if (piLogicalLine) {piLogicalLine->Release(); piLogicalLine = NULL;} if (piRun) {piRun->Release(); piRun = NULL;} if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piNode) {piNode->Release(); piNode = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} if (piConnectedPart) {piConnectedPart->Release(); piConnectedPart = NULL;} if (piInstanceValve) {piInstanceValve->Release(); piInstanceValve = NULL;} if (piInstanceElbow) {piInstanceElbow->Release(); piInstanceElbow = NULL;} cout << "CAACloPlacePart::PlacePartOnRunNode rc = " << rc << endl; return rc; }
[Top]
The CAACloPlacePart method PlacePartOnPartConnector places parts on part connectors. Again a very similar set up to previous methods is used. The method begins by placing a valve in space and then a union on one of the valve connectors. The part connector provides all of the position data needed for placement. A further example is provided of placing parts on part connectors of parts on runs. A valve is placed on Segment 5 of Run-044. A union is also placed on this valve. After that a sleeve and a nut are stacked on the union as would be necessary to connect a tube to the union. When the parts are placed on parts connectors they are connected to the existing part. Connector data is tested using the TestPartConnectorData method and the connections are tested with the TestConnectedPart method.
//============================================================================= // Place parts on part connectors. //============================================================================= HRESULT CAACloPlacePart::PlacePartOnPartConnector() { cout <<"============================================================"<< endl; cout <<"=== CAACloPlacePart::PlacePartOnPartConnector ==="<< endl; cout <<"============================================================"<< endl; HRESULT rc = CATReturnFailure; // Interface pointer variables used below in the try section. CATObject *piAppObject = NULL; CATIPspPlacePartOnRun *piPlacePart = NULL; IUnknown *piReferencePart = NULL; CATIProduct *piParentProduct = NULL; CATIPspLogicalLine *piLogicalLine = NULL; IUnknown *piInstancePart = NULL; IUnknown *piInstancePartPrevious = NULL; IUnknown *piPlaceOnCtr = NULL; CATIArrSegmentsString *piRun = NULL; CATIArrSegment *piSegment = NULL; CATUnicodeString uPlacePartErrorMessage; CATUnicodeString uStandard = "SSTL"; CATUnicodeString uSpecName = ""; CATUnicodeString uPartType; CATUnicodeString uPartNumber; CATUnicodeString uFunctionType; CATUnicodeString uPlacedPartID; CATMathDirection upDirection; CATMathDirection horizontalOrientation; CATMathPoint position; CATMathPoint ctrPosition; CATMathDirection ctrAlign; CATMathDirection ctrUp; CATListValCATBaseUnknown_var listOfSegments; CATIArrSegment_var spSegment; CATTry { // Get application object. piAppObject = new CATObject("CATTubing"); cout << "piAppObject = " << piAppObject << endl; if (piAppObject && SUCCEEDED(piAppObject->QueryInterface(IID_CATIPspPlacePartOnRun,(void**)&piPlacePart))) { cout << "piPlacePart = " << piPlacePart << endl; piParentProduct = (CATIProduct*)GetChildObject(IID_CATIProduct, "TubingWP.1"); cout << "piParentProduct = " << piParentProduct << endl; piLogicalLine = GetALogicalLine(piParentProduct); cout << "piLogicalLine = " << piLogicalLine << endl; piRun = (CATIArrSegmentsString*)GetChildObject(IID_CATIArrSegmentsString, "Run-0044", piParentProduct); cout << "piRun = " << piRun << endl; if (piRun) { piRun->ListSegments(listOfSegments); cout << "listOfSegments.Size() = " << listOfSegments.Size() << endl; if (listOfSegments.Size() >= 5) { spSegment = listOfSegments[5]; if (!!spSegment) spSegment->QueryInterface(IID_CATIArrSegment,(void**)&piSegment); cout << "piSegment = " << piSegment << endl; } } // End if valid run. if (piSegment) { do { // Dummy loop to allow easy exit on fail. // ============================================================================== // Place valve in space. // ============================================================================== // Get reference part uPartType = "CATTubControlValve"; uPartNumber = "V_BALL-TF-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { // Place part in space. uFunctionType = "CATTubControlValveFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine upDirection.SetCoord(0, 0, 1); // Part up direction parallel to z-axis. horizontalOrientation.SetCoord(0,1,0); // Align part parallel to y-axis. position.SetCoord(1000,2000,-4000); // Position part at (1000, 2000, 4000) in mm. rc = piPlacePart->PlacePartInSpace (uStandard, uFunctionType, piReferencePart, piParentProduct, piLogicalLine, uPlacedPartID, upDirection, horizontalOrientation, position, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(1014.61,2000,-4000); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(985.395,2000,-4000); ctrAlign.SetCoord(-1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } else { rc = CATReturnFailure; } } if (FAILED(rc)) break; if (piInstancePartPrevious) {piInstancePartPrevious->Release(); piInstancePartPrevious = NULL;} piInstancePart->QueryInterface(IID_IUnknown,(void**)&piInstancePartPrevious); if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} // ============================================================================== // Place union on valve. // ============================================================================== // Get reference part uPartType = "TubingUnion"; uPartNumber = "UNION-BULKHEAD-TMFL-16-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { // Get valve ctr 2. rc = GetPartConnector(piInstancePartPrevious, 2, piPlaceOnCtr); cout << "piPlaceOnCtr = " << piPlaceOnCtr << endl; // Place part on connector. uFunctionType = "CATTubTubeFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine rc = piPlacePart->PlacePartOnPartConnector (uStandard, uFunctionType, piReferencePart, piPlaceOnCtr, piLogicalLine, uPlacedPartID, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(985.395,2000,-4000); ctrAlign.SetCoord(1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { rc = TestConnectedPart(piInstancePart, 1, piInstancePartPrevious, 2); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(905.639,2000,-4000); ctrAlign.SetCoord(-1,0,0); ctrUp.SetCoord(0,0,1); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } } else { rc = CATReturnFailure; } } if (FAILED(rc)) break; if (piInstancePartPrevious) {piInstancePartPrevious->Release(); piInstancePartPrevious = NULL;} piInstancePart->QueryInterface(IID_IUnknown,(void**)&piInstancePartPrevious); if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} if (piPlaceOnCtr) {piPlaceOnCtr->Release(); piPlaceOnCtr = NULL;} // ============================================================================== // Place valve on run segment. // ============================================================================== // Get reference part uPartType = "CATTubControlValve"; uPartNumber = "V_BALL-TF-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { // Place part on segment. uFunctionType = "CATTubControlValveFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine position.SetCoord(-700,3000,1800); // in mm. rc = piPlacePart->PlacePartOnRunSegment (uStandard, uFunctionType, piReferencePart, piSegment, piLogicalLine, uPlacedPartID, position, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(-700,2985.395,1800); ctrAlign.SetCoord(0,-1,0); ctrUp.SetCoord(1,0,0); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-700,3014.61,1800); ctrAlign.SetCoord(0,1,0); ctrUp.SetCoord(1,0,0); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } else { rc = CATReturnFailure; } } if (FAILED(rc)) break; if (piInstancePartPrevious) {piInstancePartPrevious->Release(); piInstancePartPrevious = NULL;} piInstancePart->QueryInterface(IID_IUnknown,(void**)&piInstancePartPrevious); if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} // ============================================================================== // Place union on valve on run. // ============================================================================== // Get reference part uPartType = "TubingUnion"; uPartNumber = "UNION-BULKHEAD-TMFL-16-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { // Get valve ctr 2. rc = GetPartConnector(piInstancePartPrevious, 2, piPlaceOnCtr); cout << "piPlaceOnCtr = " << piPlaceOnCtr << endl; // Place part on connector. uFunctionType = "CATTubTubeFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine rc = piPlacePart->PlacePartOnPartConnector (uStandard, uFunctionType, piReferencePart, piPlaceOnCtr, piLogicalLine, uPlacedPartID, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(-700,3014.61,1800); ctrAlign.SetCoord(0,-1,0); ctrUp.SetCoord(1,0,0); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { rc = TestConnectedPart(piInstancePart, 1, piInstancePartPrevious, 2); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-700,3094.366,1800); ctrAlign.SetCoord(0,1,0); ctrUp.SetCoord(1,0,0); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } } else { rc = CATReturnFailure; } } if (FAILED(rc)) break; if (piInstancePartPrevious) {piInstancePartPrevious->Release(); piInstancePartPrevious = NULL;} piInstancePart->QueryInterface(IID_IUnknown,(void**)&piInstancePartPrevious); if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} if (piPlaceOnCtr) {piPlaceOnCtr->Release(); piPlaceOnCtr = NULL;} // ============================================================================== // Place sleeve on union. // ============================================================================== // Get reference part uPartType = "TubingBNutSleeve"; uPartNumber = "SLEEVE-CSFR-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { // Get union ctr 2. rc = GetPartConnector(piInstancePartPrevious, 2, piPlaceOnCtr); cout << "piPlaceOnCtr = " << piPlaceOnCtr << endl; // Place part on connector. uFunctionType = "CATTubTubeFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine rc = piPlacePart->PlacePartOnPartConnector (uStandard, uFunctionType, piReferencePart, piPlaceOnCtr, piLogicalLine, uPlacedPartID, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(-700,3094.366,1800); ctrAlign.SetCoord(0,-1,0); ctrUp.SetCoord(1,0,0); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { rc = TestConnectedPart(piInstancePart, 1, piInstancePartPrevious, 2); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-700,3094.366,1800); ctrAlign.SetCoord(0,1,0); ctrUp.SetCoord(1,0,0); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } } else { rc = CATReturnFailure; } } if (FAILED(rc)) break; if (piInstancePartPrevious) {piInstancePartPrevious->Release(); piInstancePartPrevious = NULL;} piInstancePart->QueryInterface(IID_IUnknown,(void**)&piInstancePartPrevious); if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} if (piPlaceOnCtr) {piPlaceOnCtr->Release(); piPlaceOnCtr = NULL;} // ============================================================================== // Place nut on sleeve. // ============================================================================== // Get reference part uPartType = "TubingNut"; uPartNumber = "B-NUT-CSFR-16S"; rc = piPlacePart->GetReferencePartFromCatalog (uStandard, uSpecName, uPartType, uPartNumber, piParentProduct, piReferencePart); cout << "piReferencePart = " << piReferencePart << endl; if (SUCCEEDED(rc) && piReferencePart) { // Get sleeve ctr 2. rc = GetPartConnector(piInstancePartPrevious, 2, piPlaceOnCtr); cout << "piPlaceOnCtr = " << piPlaceOnCtr << endl; // Place part on connector. uFunctionType = "CATTubTubeFunction"; uPlacedPartID = ""; // Null string uses name generated by PP engine rc = piPlacePart->PlacePartOnPartConnector (uStandard, uFunctionType, piReferencePart, piPlaceOnCtr, piLogicalLine, uPlacedPartID, piInstancePart); cout << "piInstancePart = " << piInstancePart << endl; if (piInstancePart) { // Test part connectors. ctrPosition.SetCoord(-700,3094.366,1800); ctrAlign.SetCoord(0,-1,0); ctrUp.SetCoord(1,0,0); rc = TestPartConnectorData(piInstancePart, 1, piParentProduct, ctrPosition, ctrAlign, ctrUp); if (SUCCEEDED(rc)) { rc = TestConnectedPart(piInstancePart, 1, piInstancePartPrevious, 2); if (SUCCEEDED(rc)) { ctrPosition.SetCoord(-700,3094.366,1800); ctrAlign.SetCoord(0,1,0); ctrUp.SetCoord(1,0,0); rc = TestPartConnectorData(piInstancePart, 2, piParentProduct, ctrPosition, ctrAlign, ctrUp); } } } else { rc = CATReturnFailure; } } if (FAILED(rc)) break; if (piInstancePartPrevious) {piInstancePartPrevious->Release(); piInstancePartPrevious = NULL;} if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} if (piPlaceOnCtr) {piPlaceOnCtr->Release(); piPlaceOnCtr = NULL;} } while (0); // End dummy loop for easy exit on fail. } // End if valid run segment. if (FAILED(rc)) { piPlacePart->GetErrorMessage(uPlacePartErrorMessage); cout << "uPlacePartErrorMessage = " << uPlacePartErrorMessage << endl; } } // End if valid place part object. } // end CATTry CATCatch (CATError, pError) { cout << "CAACloPlacePart::PlacePartInSpace *** Error Caught ***" << endl; cout << pError; rc = CATReturnError(pError); } // end CATCatch CATEndTry; if (piAppObject) {piAppObject->Release(); piAppObject = NULL;} if (piPlacePart) {piPlacePart->Release(); piPlacePart = NULL;} if (piReferencePart) {piReferencePart->Release(); piReferencePart = NULL;} if (piParentProduct) {piParentProduct->Release(); piParentProduct = NULL;} if (piLogicalLine) {piLogicalLine->Release(); piLogicalLine = NULL;} if (piInstancePart) {piInstancePart->Release(); piInstancePart = NULL;} if (piInstancePartPrevious) {piInstancePartPrevious->Release(); piInstancePartPrevious = NULL;} if (piPlaceOnCtr) {piPlaceOnCtr->Release(); piPlaceOnCtr = NULL;} if (piRun) {piRun->Release(); piRun = NULL;} if (piSegment) {piSegment->Release(); piSegment = NULL;} cout << "CAACloPlacePart::PlacePartOnPartConnector rc = " << rc << endl; return rc; }
[Top]
This use case has demonstrated how to use the CATIPspPlacePartOnRun interface to place parts in various situations. Specifically, it has illustrated how to:
[Top]
[1] | Building and Launching a CAA V5 Use Case |
1. This documents uses Unix-style forward slash (/) to separate directory names. Windows users should use backslash (\) instead of forward slash (/). |
Version: 1 [January 2008] | Document created |
[Top] |
Copyright © 2008, Dassault Systèmes. All rights reserved.