Catia V5 4us

Feature Instantiation

한스 2007. 7. 20. 15:49
Feature Instantiation


* To Create an instance,
  - Open the catalog in read only:
    . use AccessCatalog method defined in CATCatalogFactoryServices.h
  - Retrieve the StartUp
  - Instantiate the StartUp
    . use the CATISpecObject::Instantiate method
  - Set attribute values

* Open catalog
  CATIContainer * piSpecCont=...;
  CATUnicodeString catalogName = "MyCatalog.CATfct";
  CATUnicodeString clientID = "ID";
  CATICatalog * piCatalog = NULL;
  hr = ::AccessCatalog(&catalogName, &clientID, &piSpecCont, &piCatalog);

* Retrieve the StartUp if it hasn't already been done:
  CATBaseUnknown * myStartuUp = NULL;
  CATUnicodeString myStartUp = "MyStartUp";
  rc = piCatalog->RetrieveSU(&myStartUp,
                                          &myStartUpType,
                                          "CATISpecObject");

* Instantiate the StartUp i the feature container
  CATISpecObject * piSpecOnStartUp = NULL;
  rc = myStartUp->QueryInterface(IID_CATISpecObject ,
                                          (void**) &piSpecOnStartUp);
  CATISpecObject * piSpecOnInstance = piSpecOnStartUp->
                       instanticate("MyStartUp", piSpecCont);