Equipment & Systems |
Schematics Platform Modeler |
Creating Schematic Application Sample "StartUp" objectsWorking with Schematic Components |
Use Case |
AbstractThis article discusses the CAASchAppCreateCATfct use case. |
This use case is intended to help you understand how to create the "base features", or StartUps, of a typical schematic application. They are the base objects of schematic feature extensions used in sample programs to illustrate the implementations of schematic platform interfaces in this Framework.
[Top]
CAASchAppCreateCATfct is a use case of the CAASchPlatformModeler.edu framework that illustrates the procedures to define "base feature" classes and their attributes.
[Top]
The sample takes an input ".CATfct" file that contains the basic classes ASMPRODUCT, CONNECTOR, and CONNECTION. It then adds new sample schematic application classes (which are derived from the basic classes and shown in light blue in the diagram below) and attributes to the file and saves all the modification to a directory specified by the user.
![]() |
[Top]
To launch CAASchAppCreateCATfct, you will need to set up the build time environment, then compile CAASchAppCreateCATfct 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]
CAASchAppCreateCATfct code is located in the CAASchAppCreateCATfct.m use case module of the CAASchPlatformModeler.edu framework:
Windows | InstallRootDirectory\CAASchPlatformModeler.edu\CAASchAppCreateCATfct.m |
Unix | InstallRootDirectory/CAASchPlatformModeler.edu/CAASchAppCreateCATfct.m |
where InstallRootDirectory
is the root directory of your CAA V5
installation. The name of the source file is CAASchAppCreateCATfctMain.cpp.
Additional prerequisite code is located in the CAASchAppUtilities.m module of the same framework.
[Top]
There are 3 logical steps in CAASchAppCreateCATfct:
[Top]
In this use case, we open an input "CATfct" that contains the basic classes that our sample classes are to be derived from. Initializing the environment involves the following:
CATUnicodeString uClientId (SCHEDUAppClientID); rc = ::UpgradeCatalog(&uCATFctToLoad, &piCatalog, &uClientId);
[Top]
Method CAACreateBaseFeatureSU is the main method that creates new classes and attributes for the sample application. The code can be divided into the following steps:
CATListPtrCATBaseUnknown *pCAASUList = new CATListPtrCATBaseUnknown();
This list will contain a pointer to CATBaseUnknown for each created StartUp.
... CATListValCATUnicodeString CAALUClass; CATListValCATUnicodeString CAALUSuperClass; CATListValCATUnicodeString CAALUName; // class SuperClass CAALUClass.Append(SCHEDUClass_Part); CAALUSuperClass.Append(SCHEDUClass_ASMPRODUCT); ... CAALUName.Append(SCHEDUName_Part); ...
Three CATUnicodeString lists are created: the first for the StartUp class names, the second for the StartUp superclass names, and the third for the StartUp names. The indices of a given StartUp is the same in these three lists. The CATUnicodeString classes are initiliazed in CAASchAppClassNames.h, located in the PrivateInterfaces folder of CAASchPlatformModeler.edu framework.
... CATBaseUnknown *pBU = NULL; for (int iClass=1; iClass<=NbSizeClass; iClass++) { rc = E_FAIL; pBU = NULL; CATUnicodeString uName (CAALUName[iClass]); CATUnicodeString uClass (CAALUClass[iClass]); CATUnicodeString uSuperClass (CAALUSuperClass[iClass]); if (uSuperClass.GetLengthInChar()) { rc = iCatalog->CreateSUInCatalog (&pBU, // Pointer to the created StartUp &uName, // StartUp name &uClass, // StartUp class name "CATISpecObject", // Required CATISpecObject type &uSuperClass); // StartUp super class name } else { rc = iCatalog->CreateSUInCatalog (&pBU, &uName, &uClass, "CATISpecObject"); } if (SUCCEEDED(rc) && (NULL != pBU)) { pCAASUList->Append (pBU); ...
For each StartUp, the CATICatalog::CreateSUInCatalog method is called from the CATICatalog pointer to the StartUp catalog. If the StartUp has no super class, CreateSUInCatalog signature with four arguments is used. When the StartUp is successfully created, the retrieved pointer to that StartUp is stored in the list for later use, such as adding attributes.
... int BUOfConnectorIndex = 7; CATISpecObject *piSpecCntrSU = (CATISpecObject *) ((*pCAASUList)[BUOfConnectorIndex]); CATISpecAttribute *piSpecAttr = NULL; if (NULL != piSpecCntrSU) { piSpecAttr = piSpecCntrSU->AddAttribute (SCHEDUATTR_Connector_FlowCapacity, // Attribute name tk_integer); // Attribute type ...
A CATISpecObject pointer is retrieved to the seventh created StartUp, and the CATISpectObject::AddArttribute method is called to add a tk_integer attribute. The attribute name is initialized in CAASchAppClassNames.h, located in the PrivateInterfaces folder of CAASchPlatformModeler.edu framework.
The pointers in the StartUp list are released and set to NULL, and the list itself is deleted.
[Top]
The following steps conclude the use case:
rc = ::SaveCatalog (&piCatalog,&uCATFctToOutput);
[Top]
This use case has demonstrated how to define new classes and attributes for a typical schematic application.
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[2] | Loading a Document |
Version: 1 [April 2004] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.