Mechanical Design

Assembly Design

Analyzing Degrees of Freedom of a Component in an Assembly

Retrieve a sub-component named "DoF" under the root product and analyzes its degrees of freedom
Use Case

Abstract

This article discusses the CAAAsmAnalyzeFreedoms use case. This use case explains how to analyze the degrees of freedom of a component in a product.


What You Will Learn With This Use Case

This use case is intended to help you to use the capability of analyzing the degrees of freedom of a component product which can be constrained. More specifically, you will learn how to:

[Top]

The CAAAsmAnalyzeFreedoms Use Case

CAAAsmAnalyzeFreedoms is a use case of the CAAAssemblyUI.edu framework that illustrates the ConstraintModeler framework capabilities.

Before discussing the use case, some main concepts have to be introduced:

[Top]

What Does CAAAsmAnalyzeFreedoms Do ?

CAAAsmAnalyzeFreedoms does the following:

[Top]

How to Launch CAAAsmAnalyzeFreedoms

To launch CAAAsmAnalyzeFreedoms, you will need to set up the build time environment, then compile CAAAsmAnalyzeFreedoms along with its prerequisites, set up the run time environment, and then execute the use case [1].

Launch the use case as follows:

where:

InputDirectory: The directory into which the document Fou.CATProduct is stored, usually in the resources directory of your RuntimeView

[Top]

Where to Find the CAAAsmAnalyzeFreedoms Code

The CAAAsmAnalyzeFreedoms use case is located in the CAAAsmAnalyzeFreedoms.m module of the CAAAssemblyUI.edu framework:

Windows InstallRootDirectory\CAAAssemblyUI.edu\CAAAsmAnalyzeFreedoms.m\
Unix InstallRootDirectory/CAAAssemblyUI.edu/CAAAsmAnalyzeFreedoms.m/

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

[Top]

Step-by-Step

There are five main steps in CAAAsmAnalyzeFreedoms:

  1. Prolog
  2. Scanning the root product chilfren to retrieve the component named "DoF"
  3. Compute the number of degrees of freedom of "DoF" component
  4. Analyze all these eventual degrees of freedom
  5. Epilog

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

[Top]

Prolog

CAAAsmAnalyzeFreedoms begins by checking that the command lines contains one argument with the command name "CAAAsmAnalyzeFreedoms". Then it creates a session, and load the document which name is this argument. If the document does not exist a code 11 is returned.

Then CAAAsmAnalyzeFreedoms retrieves the document's root product, handled by the pointer spRootProduct which is a pointer to CATIProduct interface. This is the usual sequence to browse a product structure [3] and find the root product pointer to CATIProduct, from the document which name is the argument Foo.CATProduct above.

spRootProduct A pointer to CATIProduct onto the root product of the document

[Top]

Scanning the root product chilfren to retrieve the component named "DoF"

  ...
   CATIProduct_var P_i;
   int Found= 0;
   CATListValCATBaseUnknown_var * Components = spRootProduct->GetChildren();
   if( Components!= NULL )
   {
	  int NChildren = Components->Size( );
	  for( int ch_i = 1 ; ch_i <= NChildren ; ch_i++ )
	  {
		  P_i = (*Components)[ch_i];
		  CATIAlias_var Alias = P_i;
		  if( NULL_var != Alias )
		  {
			  CATUnicodeString Str= Alias->GetAlias();
			  if( Str =="DoF")
			  { Found=1; break;}
		  } 
		  
	  }
	  delete Components;
	  Components = NULL;
   }
   // Found set to one means that a component name "DoF" was found
  ...

[Top]

Compute the number of degrees of freedom of "DoF" component

  ...
	   int oNbDegreesOfFreedom=0;
	   CATIDegreesOfFreedom_var Degrees = P_i;
	   if(Degrees!=NULL_var)
	   {
		  CATDoFStatusEnum Valid;
		  HRESULT hr=Degrees->GetNbDegreesOfFreedom(Valid,oNbDegreesOfFreedom);
  ...

The oNbDegreesOfFreedom variable gives the expected information whenever the request is valid. The request is valid when the output argument Valid of method GetNbDegreesOfFreedom is valuated to DoF_Acceptable. Note that the theoritical possible values for these argument are :

DoF_Acceptable The request was succesfull
DoF_KONotUpdated The degrees of freedom could not be computed because the root product is not up to date
DoF_KONoFather The request has no sense because the component has no father bloc.
DoF_KONotABloc The request has no sens because the component is not a bloc. Note that a product is always a bloc.
DoF_KOOther There was an internal problem.Please report as a bug.

[Top]

Analyze all these eventual degrees of freedom

The function GetDegreesOfFreedom returns the type of the degree of freedom (oType) and the mathematical data associated to it (oData). there are 3 types of freedom : translation, rotation or screw. Screw is the combination of a rotation and a translation parallel to the axis of the rotation.

GetDegreesOfFreedom must be called on the same smart pointer on which the function GetNbDegreesOfFreedom was called. Indeed, the first method GetNbDegreesOfFreedom computes all the necessary information ans stores them in the smart pointer. These information are just returned to the user when he calls the second function GetDegreesOfFreedom.
  ...
      for(int i=1;i<=oNbDegreesOfFreedom;i++)
	    {
		  CATDoFTypeEnum oType;
		  double oData[]={0.,0.,0.,0.,0.,0.,0.};
//        "Degrees" must be the smart pointer on which the function GetNbDegreesOfFreedom was called
		  HRESULT hr = Degrees->GetDegreesOfFreedom(i,oType,oData);
		  if(oType==DoF_Translation)
	        {
//            the freedom number i  is a TRANSLATION
//            the translation vector is (oData[0],oData[1],oData[2])
		    }
		  else if(oType==DoF_Rotation)
	        {
//            the freedom number i  is a ROTATION
//            the direction of its axis is (oData[0],oData[1],oData[2]) 
//            the pole of      its axis is (oData[3],oData[4],oData[5])
		    }
		  else if(oType==DoF_Screw)
		    {
//            the freedom number i  is a SCREW
//            the direction of the screw        is (oData[0],oData[1],oData[2])
//            the pole of the axis of the screw is (oData[3],oData[4],oData[5])
//            the pitch is oData[6] 
		    }
  ...

[Top]

Epilog

The documeznt is removed and the session is closed

  ...
     CATDocumentServices::Remove(*pProductDocument);
     Delete_Session("Session_ASSEMBLY");
  ...

In Short

This use case has demonstrated the way to analyze a component product under a root product by calling the 2 functions GetNbDegreesOfFreedom and GetDegreesOfFreedom on the smart pointer to interface CATIDegreesOfFreedom (on which adherates the component product)

[Top]


References

[1] Building and Launching a CAA V5 Use Case
[2] Browsing a Product Structure
[Top]

History

Version: 1 [May 2004] Document created
[Top]

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