Equipment & Systems |
Arrangement |
Creating and Querying Pathway, Run ObjectsHow to query Pathway, Run objects |
Use Case |
AbstractThis article discusses the CAAArrPathwayRun use case. |
This use case is intended to show you how to retrieve the different Pathways and query them for more information.
CAAArrPathwayRuns is a use case of the CAAArrangementInterfaces.edu framework that illustrates capabilities querying a Pathway. Similar steps could be followed to query document having "Piping Run", "Tubing Run", etc.
[Top]
The goal of CAAArrPathwayRuns is to show you how to use the interfaces from CATArrangementInterfaces framework (CATIArrSegmentsString, CATIArrSegment, CATIArrNode, CATIRouSection, CATIRouRectSection, CATIRouRoundSection, CATIRouRadiusCornerSection) to query and obtain information about Pathway.
[Top]
To launch CAAArrPathwayRuns, you will need to set up the build time environment, then compile CAAArrPathwayRuns along with its prerequisites, set up the run time environment, and then execute the sample. This is fully described in the referenced article [1]. When launching the use case, you must pass the following arguments:
[Top]
CAAArrPathwayRuns code is located in the CAAArrPathwayRuns.m use case module of the CAAArrangementInterfaces.edu framework:
Windows | InstallRootDirectory\ CAAArrangementInterfaces.edu\ CAAArrPathwayRuns.m |
Unix | InstallRootDirectory/ CAAArrangementInterfaces.edu/ CAAArrPathwayRuns.m |
where InstallRootDirectory
is the root directory of your CAA V5
installation. It is made of two unique source files named CAAArrPathwayRunsMain.cpp and
CAAArrPathwayRuns.cpp.
Additional prerequisite code is located in the CAAArrUtilities.m directory of the same framework.
[Top]
There are five logical steps in CAAArrPathwayRuns:
[Top]
In this use case, we open an input document containing three Path Reservation objects . We retrieve the Path Reservations one by one and scan them. First PR has one segment and round cross-section, location of 'section point' being center-center. Second PR has two segments and rectangle cross-section, location of 'section point' being bottom-center. The segments are at 90 deg to each other and have a turning radius. Third PR has one segment and rectangle cross-section with a radius fillet at all corners, location of 'section point' being bottom-center.
[Top]
The CAAArrPathwayRuns code is derived from the CAAArrBaseEnv base class. Initializing the environment involves the following methods:
CAAArrBaseEnv::CreateCATProductEnv (iFileToBeLoaded); // It is required for all batch programs accessing Routable/Arrangement // objects to call ApplicationInit() so that CMG geometries are saved CAAArrBaseEnv::ApplicationInit(); |
This method performs the following functions:
[Top]
From the document, get to the root product and then to its first child. Check
that the retrieved object is a SubTypeOf "ArrPathway"
pDoc = CAAArrBaseEnv::GetDocument(); if(pDoc) { // Obtain the Root of the Document spRootPrd = ::PrdGiveDocRootProduct (pDoc); if(!! spRootPrd) { // Retrieve the Children of the Document lstPrd = spRootPrd->GetChildren(); int iSizelstPrd = 0; if ( lstPrd ) iSizelstPrd = lstPrd->Size(); if(iSizelstPrd >= 3) { // Retrieve and scan the first PathReservation spSpec1 = (*lstPrd)[1]; if ( !! spSpec1 ) { spSpec1->QueryInterface(IID_CATISpecObject,(void**)&piSpecOnPathRes01); if(piSpecOnPathRes01 && piSpecOnPathRes01->IsSubTypeOf("ArrPathway")) { // Query and retrieve CATIArrSegmentsString from piSpecOnPathRes01 // Using CATIArrSegmentsString, Get the section (CATIRouSection), check that it is // "round" (CATIRouRoundSection), retrieve its Diameter // Using CATIArrSegmentsString, list the number of segments. For each segment, // get a handle to CATIArrSegment. Using CATIArrSegment, retrieve the 'Section SetPoint'. // Using handle to CATIArrSegment, get the two nodes (CATIArrNode). Using this // handle to the node, verify that each node is an extremity node. } } |
[Top]
From the root product, get to its second child. Check that the retrieved object is a SubTypeOf "ArrPathway"
// Retrieve and scan the second PathReservation spSpec2 = (*lstPrd)[2]; if ( !! spSpec2 ) { spSpec2->QueryInterface(IID_CATISpecObject,(void**)&piSpecOnPathRes02); if(piSpecOnPathRes02 && piSpecOnPathRes02->IsSubTypeOf("ArrPathway")) { // Query and retrieve CATIArrSegmentsString from piSpecOnPathRes02 // Using CATIArrSegmentsString, Get the section (CATIRouSection), check that it is // "rectangular" (CATIRouRectSection), retrieve its Height and Width. // Using CATIArrSegmentsString, list the number of segments. For each segment, // get a handle to CATIArrSegment. Using CATIArrSegment, retrieve the 'Section SetPoint'. // Using handle to CATIArrSegment, get the two nodes (CATIArrNode). Using this // handle to the node, verify if the node is an extremity node, otherwise calculate angle // with which the PathReservation turns. If any valid turn exists, get a handle to // CATIRouNode. Then, if a valid turn ( meaning the corresponding Arc is within limits // and is consistent with its adjacent segments ) is found on the node, retrieve the arc // which corresponds to this node and the details of the Arc. } } |
[Top]
From the root product, get to its third child. Check that the retrieved object is a SubTypeOf "ArrPathway"
// Retrieve and scan the third PathReservation spSpec1 = (*lstPrd)[3]; if ( !! spSpec3 ) { spSpec3->QueryInterface(IID_CATISpecObject,(void**)&piSpecOnPathRes03); if(piSpecOnPathRes03 && piSpecOnPathRes03->IsSubTypeOf("ArrPathway")) { // Query and retrieve CATIArrSegmentsString from piSpecOnPathRes03 // Using CATIArrSegmentsString, Get the section (CATIRouSection), check that it is // "rectangular with round corners" (CATIRouRadiusCornerSection), retrieve its Height, // Width, Radius of the round corner. // Using CATIArrSegmentsString, list the number of segments. For each segment, // get a handle to CATIArrSegment. Using CATIArrSegment, retrieve the 'Section SetPoint'. // Using handle to CATIArrSegment, get the two nodes (CATIArrNode). Using this // handle to the node, verify that each node is an extremity node. } } |
[Top]
This use case has demonstrated how to use the Arrangement interfaces to query an PathReservation. Specifically, it has illustrated:
[Top]
[1] | Building and Launching a CAA V5 Use Case |
Version: 1 [Oct 2003] | Document created |
[Top] |
Copyright © 2003, Dassault Systèmes. All rights reserved.