Machining

3 Axis Surface Machining

Creating a Surface Machining Operation StartUp

Define your own surface machining operation StartUp and store it in a library
Use Case

Abstract

This article discusses the CAASmiUserOperationCatalog use case and explains how to generate a library file including the CAA SMG Operation Initial Definition: its StartUp. This step is the preliminary one for all NC Operation creation.


What You Will Learn With This Use Case

This use case is intended to help you to generate a new library containing Surface Machining Operation StartUps.

This involves the following:

[Top]

The CAASmiUserOperationCatalog Use Case

CAASmiUserOperationCatalog is a use case of the CAASurfaceMachiningItf.edu framework that illustrates Surface Machining capabilities.

It is the first step of the sample described in the technical article [1].

[Top]

What Does CAASmiUserOperationCatalog Do

CAASmiUserOperationCatalog enables the customer to generate a new catalog containing two new StartUps :

[Top]

How to Launch CAASmiUserOperationCatalog

To launch CAASmiUserOperationCatalog, you will need to:

[Top]

Where to Find the CAASmiUserOperationCatalog Code

CAASmiUserOperationCatalog code is located in the CAASmiUserOperationCatalog.m module of the CAASurfaceMachiningItf.edu framework:

Windows InstallRootDirectory\CAASurfaceMachiningItf.edu\CAASmiUserOperationCatalog.m
Unix InstallRootDirectory/CAASurfaceMachiningItf.edu/CAASmiUserOperationCatalog.m

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.

[Top]

Step-by-Step

There are five logical steps in CAASmiUserOperationCatalog:

  1. Creating a New Library of Activities
  2. Opening Prerequisite Catalogs
  3. Creating StartUps in this Catalog
  4. Adding Parameters to StartUps
  5. Saving the New Catalog

We will now comment each of those sections by looking at the code.

[Top]

Creating a New Library of Activities

We have to create a new document of Process Library type.

 
//Creation of session
CATSession *pSession = NULL;
rc = ::Create_Session("Session_CAA", pSession );
if (FAILED(rc)) return 1;

//Creation of a new activities catalog
CATDocument* pLib=NULL;
CATDocumentServices::New("CATfct",pLib);

//Initialize root container
CATIMfgCatalogFactories *piFact=NULL;
CATString ClassName("CATMfgCatalogFactories");
CATInstantiateComponent (ClassName,
			CATIMfgCatalogFactories::ClassId(),
			(void**)& piFact);
if (piFact == NULL) return 2;

//Creation of manufacturing activity container
CATIContainer_var spCont;
if (piFact)
{
   piFact->CreateActivityRootCont(pLib,spCont);
   piFact->Release();
   piFact = NULL;
}
if (NULL_var == spCont) return 3;
		
// Add client ID
CATInit_var spInitOnDoc = pLib;    
if (NULL_var == spInitOnDoc) return 4;
if (NULL_var != pInitOnDoc) 
{
	spInitOnDoc->Init(FALSE);
	CATBaseUnknown *  pRoot = spInitOnDoc -> GetRootContainer(CATIContainer::ClassName());
	if (NULL != pRoot) 
	{
		CATIContainer_var ActivityCatalog = pRoot;
		pRoot->Release();
		pRoot = NULL;
				
		CATICatalog_var hCatalogTemp = ActivityCatalog;
		if (NULL_var != hCatalogTemp)
		{
			CATUnicodeString ClientID = "CLIENT";
			HRESULT HRID = hCatalogTemp-> SetClientId (&ClientID);
		}
	}
}
		
//Retrieve activities library document root container
CATISPPActivityTypeFactory *piRootActivity = (CATISPPActivityTypeFactory* )
							pInitOnDoc->GetRootContainer("CATISPPActivityTypeFactory");
if ( NULL == piRootActivity ) return 5;
...

[Top]

Opening Prerequisite Catalogs

To define the StartUp of CAASmgOperation, we need that our operation will use its own Machining Feature. We will define later CAASmgMachiningFeature by generating a new CAAUserMachiningFeatures.CATfct catalog. So this catalog is the prerequisite catalog we need to load.

  ...
  // catalog containing the user machining feature we will authorize on the new activity
  CATICatalog * pICatalog = NULL;
  CATUnicodeString CatalogFeature ("CAAUserMachiningFeatures.CATfct");
  CATUnicodeString ClientID ("CAAManufacturing");
  ::AccessCatalog(&CatalogFeature,&ClientID,pIRootContainer,&pICatalog);
  if (pICatalog) pICatalog->Release();
  pICatalog = NULL;
  ...

[Top]

Creating StartUps in this Catalog

To create StartUps of CAA operations deriving from the StartUp "MfgUserDefinedMO", we use the method CreateMachiningOperationSU of the CATIMfgStartupFactories interface.

We allow CAASmgOperation to use the CAASmgMachiningFeature machining feature.

  ...
// the CAASmgOperation late type
const CATUnicodeString CAASmgOperationType = "CAASmgOperation";      

// the list of the features you want to authorized on this Startup.
CATListOfCATUnicodeString FeatureTypeNameList;
// CAASmgOperation will be based on our user machining feature 
FeatureTypeNameList.Append("CAAISmiUserMachFeature");

rc = piSUFact->CreateMachiningOperationSU(&piNewStartUp1,
                                             piClientCatalog,
                                             pIRootContainer,
                                             CAASmgOperationType, 
                                             ActivitySuperTypeName,
                                             FeatureTypeNameList);
  ...

Then, we allow CAASmgOperationWithMA to use machining areas.

  ...
// the CAASmgOperationWithMA late type
const CATUnicodeString CAASmgOperationWithMAType = "CAASmgOperationWithMA";      

// the list of the features names you want to authorized on this Startup.
CATListOfCATUnicodeString FeatureTypeNameList2;
// CAASmgOperationWithMA will be based on machining areas
FeatureTypeNameList2.Append("CATIM3xFeature");

rc = piSUFact->CreateMachiningOperationSU(&piNewStartUp2,
                                             piClientCatalog,
                                             pIRootContainer,
                                             CAASmgOperationWithMAType, 
                                             ActivitySuperTypeName,
                                             FeatureTypeNameList2);
  ...

[Top]

Adding Parameters to StartUps

We add three parameters ("CAAStep", "CAAToolAngle" and "CAAApproachDistance") to CAASmgOperation and one ("CAAOffset") to CAASmgOperationWithMA, by using the CATIMfgManufacturingParameters interface.

In order to be able to use the interface CATIMfgManufacturingParameters we should create an instance of the class CATMfgManufacturingParameters with the global function CATInstantiateComponent.

  ...
  CATIMfgManufacturingParameters *piParm =NULL;

  CATString ClassName("CATMfgManufacturingParameters");
  ::CATInstantiateComponent (ClassName,
                             CATIMfgManufacturingParameters::ClassId(),
                             (void**)& piParm);

  CATICkeParmFactory_var spFactL(piRootActivity);
  if (piParm && !!spFactL)
  {
    CATBaseUnknown_var hObj;	   
    CATICkeParm_var spParam;
    CATIParmAsStored_var spValue;

    //=============================================
    // CAASmgOperation Parameters
    //=============================================
    hObj = piNewStartUp1;

    // Strategy parameter
    spParam = spFactL->CreateLength("CAAStep", 0.0);
    spValue = spParam;
    if (!!spValue) spValue->ValuateStored(10.0); // Default Value
    rc = piParm->AddStrategyParameterToActivity (hObj,"CAAStep",spParam);

    // Macro parameters
    spParam = spFactL->CreateAngle("CAAToolAngle", 0.0);
    spValue = spParam;
    if (!!spValue) spValue->ValuateStored(2.0); // Default Value
    rc = piParm->AddStrategyParameterToActivity (hObj,"CAAToolAngle",spParam);

    spParam = spFactL->CreateLength("CAAApproachDistance", 0.0);
    spValue = spParam;
    if (!!spValue) spValue->ValuateStored(20.0); // Default Value
    rc = piParm->AddStrategyParameterToActivity (hObj,"CAAApproachDistance",spParam);

 ...

[Top]

Saving the New Catalog

Finally we just have to save the catalog and delete the session.

 ...
CATDocumentServices::SaveAs(*pLib,"CAAUserOperationCatalog.CATfct");

// delete the session, removes the opened documents also.
// never forget to delete a creating session after usage.
rc = ::Delete_Session("Session_CAA");
...

[Top]


In Short

This use case has demonstrated how to create Operations StartUps in the newly created "CAAUserOperationCatalog.CATFct library. It derives from the late type "MfgUserDefinedMO" as every user defined operation should do it.

This StartUp will later be used in the next use case [3].

[Top]


References

[1] Surface Machining Operation Sample Overview
[2] Building and Launching a CAA V5 Use Case
[3] Customizing the Surface Machining Operation Editor
[Top]

History

Version: 1 [Mar 2002] Document created
[Top]

Copyright © 2002, Dassault Systèmes. All rights reserved.