iCAx开思网

标题: 【求助】谁告诉我catia里如何获得自己改写过的JournalList [打印本页]

作者: acoka    时间: 2004-5-18 17:21
标题: 【求助】谁告诉我catia里如何获得自己改写过的JournalList
我在做一个feature的时候,其中重写了CATBuildShape,省了中间过程,对JournalList进行重写,并给各个面标了Info,
但在之后的操作里,无法取得CATCGMJournalList, 本来是想直接读改写过的info,给各个面上加工特性
如果通过UG类似的Tag倒也可以,就是如果一次有成千上个面的时候,检索会比较费时间
哪位能否指教一下如何实现CATISpecObject->CATIMfJournal的获取方法
不会是StoreProcReport后就不给用了吧
不胜感激
  
// COPYRIGHT  2004
//===================================================================
//
// WSHEDSPRTHPCHolePartBuildShape.cpp
// Provide implementation to interface
//    CATIBuildShape
//
//===================================================================
//
// Usage notes:  BuiltShape implemment
//
//===================================================================
//  May 2004  Creation: Code generated by the CAA wizard  zzsou1
//===================================================================
#include "WSHEDSPRTHPCHolePartBuildShape.h"
#include "CATIUpdateError.h"
#include "CATIGeometricalElement.h"
#include "CATISpecObject.h"
#include "CATMathDirection.h"
#include "CATIPrtFactory.h"
#include "CATISketchFactory.h"
#include "CATInit.h"
#include "CATListOfDouble.h"
#include "CATIMfProcReport.h"
#include "CATGeoFactory.h"
#include "CATSoftwareConfiguration.h"
#include "CATTopData.h"
#include "CATSolidCylinder.h"
#include "CATBody.h"
#include "CATDynBoolean.h"
#include "CATCGMJournalList.h"
#include "CATCGMJournalInfo.h"
  
#include "WSHIDSPRTHPCHolePart.h"
#include "WSHDSPRTHPCBuildErr.h"
  
CATImplementClass( WSHEDSPRTHPCHolePartBuildShape,
                   DataExtension,
                   CATBaseUnknown,
                   WSHDSPRTHPCHole );
   
//-----------------------------------------------------------------------------
// WSHEDSPRTHPCHolePartBuildShape : constructor
//-----------------------------------------------------------------------------
"WSHEDSPRTHPCHolePartBuildShape::WSHEDSPRTHPCHolePartBuildShape"
WSHEDSPRTHPCHolePartBuildShape::WSHEDSPRTHPCHolePartBuildShape():
    WSHCADCMNMDLExtIBuild()
{
  
}
  
//-----------------------------------------------------------------------------
// WSHEDSPRTHPCHolePartBuildShape : destructor
//-----------------------------------------------------------------------------
"WSHEDSPRTHPCHolePartBuildShape::~WSHEDSPRTHPCHolePartBuildShape"
WSHEDSPRTHPCHolePartBuildShape::~WSHEDSPRTHPCHolePartBuildShape()
{
  
}
   
// Tie the implementation to its interface
// ---------------------------------------
#include "TIE_CATIBuildShape.h"
TIE_CATIBuildShape( WSHEDSPRTHPCHolePartBuildShape);
//-----------------------------------------------------------------------------
// Implements CATIBuildShape::BuildShape
//-----------------------------------------------------------------------------
"WSHEDSPRTHPCHolePartBuildShape::BuildShape"
int WSHEDSPRTHPCHolePartBuildShape::BuildShape ()
{
  
  
  
  int Ret = 0;
  HRESULT rc = S_OK;
  do{
    // reset update error
    CATIUpdateError_var spUpdateError = this;
    if(!spUpdateError){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705001"));
      break;
    }
    spUpdateError->UnsetUpdateError();
  
    CATIGeometricalElement_var spGeomElement = this;
    if(!!spGeomElement){
      spGeomElement->DeleteScope();
    }
  
    // get attribute of feature
    WSHIDSPRTHPCHolePart_var spHolePart = this;
    if(!spHolePart){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705002"));
      break;
    }
    CATMathPoint OriginPoint = spHolePart->GetOrigin();
    CATMathDirection HolePartDirection = spHolePart->GetAxisDirection();
    double OffsetValue = spHolePart->GetOffsetValue();
    int StepValue = spHolePart->GetStepValue();
    CATRawColldouble* pDiamterValueList = spHolePart->GetDiameterValue();
    CATRawColldouble* pDepthValue = spHolePart->GetDepthValue();
  
    // get a factory
    CATGeoFactory_var spGeoFactory = GetGeoFactory();
    if(!spGeoFactory){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705003"));
      break;
    }
    CATGeoFactory* pImpGeoFactory = spGeoFactory->GetImplicitGeoFactory();
    if( !pImpGeoFactory ) {
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705003"));
      break;
    }
  
    CATSoftwareConfiguration* pSoftwareConfiguration = new CATSoftwareConfiguration();
    // make a pre-journallist
    CATCGMJournalList* pJournalList = new CATCGMJournalList(
      pSoftwareConfiguration,
      WSHL
    );
    if( !pJournalList ) {
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705004"));
      break;
    }
    CATTopData topData( pSoftwareConfiguration, pJournalList );
  
    // procReport取得
    CATIMfProcReport_var spProcReport = this;
    if(!spProcReport){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705005"));
      break;
    }
    CATLISTV(CATBaseUnknown_var) ListSpec;
    CATListOfCATUnicodeString    ListKeys;
    spProcReport->CreateProcReport(ListSpec,ListKeys,0);
    // create a real journal
    CATCGMJournalList* pMainJournalList = spProcReport->GetCGMJournalList();
    if(!pMainJournalList){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705005"));
      break;
    }
    CATSoftwareConfiguration* pSoftwareConfigurationMain = new CATSoftwareConfiguration();
    CATTopData topDataMain( pSoftwareConfigurationMain, pMainJournalList );
    CATLISTP(CATGeometry) operands;
  
    // 面<->Info
    int InfoIndex[1][4] = { 1, 1, 2, 0 }; // 0:頂面 1:側面 2:底面 999:
  
    //  make cylinders
    CATBody_var spTotalBody = pImpGeoFactory->CreateBody();
    if ( !spTotalBody ) {
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705006"));
      break;
    }
    CATBody* pBoolResultBody = WSHL;
    double OffsetStart = OffsetValue;
    for ( int iCnt = 1; iCnt <= StepValue ; iCnt++ ) {
      
      // 段開始面中心点
      
      if ( iCnt >1 ) {
        OffsetStart += (*pDepthValue)[iCnt-1];
      }
      CATMathPoint StartPoint( OriginPoint.GetX() + HolePartDirection.GetX()*OffsetStart,
                OriginPoint.GetY() + HolePartDirection.GetY()*OffsetStart,  
                OriginPoint.GetZ() + HolePartDirection.GetZ()*OffsetStart );
  
      // 段底面中心点
      double OffsetEnd = OffsetStart + (*pDepthValue)[iCnt];
      CATMathPoint EndPoint( OriginPoint.GetX() + HolePartDirection.GetX()*OffsetEnd,
                OriginPoint.GetY() + HolePartDirection.GetY()*OffsetEnd,  
                OriginPoint.GetZ() + HolePartDirection.GetZ()*OffsetEnd );
      
      // 作成
      CATSolidCylinder* pCylinder = WSHL;
      CATTry{
        pCylinder = CATCreateSolidCylinder(pImpGeoFactory,
                           &topData,
                           StartPoint,
                           EndPoint,
                           (*pDiamterValueList)[iCnt]/2);
        if(!pCylinder){
          rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705007"));
          break;
        }
  
      }CATCatch(CATError, pError){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705007"));
        delete pCylinder;
        pCylinder = WSHL;
        break;
      }CATEndTry;
  
      CATBody* pCylinderBody = pCylinder->GetResult();
      if(!pCylinderBody){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705007"));
        break;
      }
  
      CATBody_var spCylinderBody = pCylinderBody;
      if(!spCylinderBody){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705007"));
        break;
      }
      
      CATLISTP(CATCell) cellListFace;
      spCylinderBody->GetAllCells(cellListFace,2);
  
      for ( int iInfoCnt = 1; iInfoCnt<=cellListFace.Size(); iInfoCnt++ ) {
  
        CATFace* pFace = (CATFace*)cellListFace[iInfoCnt];
        if(!pFace){
          continue;
        }
        
        pMainJournalList->ReportCreation( operands, (CATGeometry*)pFace , new CATCGMJournalInfo( iCnt*100 + InfoIndex[0][iInfoCnt-1] ) );
      }
  
      // 取和
      CATDynBoolean* pOperatorBool = CATCreateDynBoolean(pImpGeoFactory,
                         &topDataMain,
                         CATBoolUnion,
                         spTotalBody,
                         spCylinderBody);
  
      if(!pOperatorBool){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705008"));
        break;
      }
      CATTry{
        pOperatorBool->Run();
      }
      CATCatch(CATError,pError){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705008"));
        break;
      }
      CATEndTry;
  
      if ( !!pBoolResultBody ) {
        pImpGeoFactory->Remove( pBoolResultBody, CATICGMContainer::RemoveDependancies  );
        pBoolResultBody = WSHL;
      }
      pBoolResultBody = pOperatorBool->GetResult();
      if(!pBoolResultBody){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705008"));
        break;
      }
      spTotalBody = pBoolResultBody;
      if(!spTotalBody){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705008"));
        break;
      }
  
      if(!!pOperatorBool){
        delete pOperatorBool;
        pOperatorBool = WSHL;
      }
  
      if ( !!pCylinderBody ) {
        pImpGeoFactory->Remove( pCylinderBody, CATICGMContainer::RemoveDependancies  );
        pCylinderBody = WSHL;
      }
  
      if(!!pCylinder){
        delete pCylinder;
        pCylinder = WSHL;
      }
    } //for
  
    pMainJournalList->Tass();
    // 結果保存
    if( SUCCEEDED(rc) && spProcReport != WSHL){
      spTotalBody->SetMode( CatCGMExplicit );
      spTotalBody->Completed( TRUE );         
      spProcReport->StoreProcReport(spTotalBody,NoCopy,0);  
    }
  
  } while ( FALSE );
  
  SUCCEEDED( rc ) ? Ret = 1 : Ret = 0 ;
  return Ret;
}
作者: acoka    时间: 2004-5-19 19:27
结果是推测达索为防止数据结构被破坏,没有公开get的interface
时间紧要交货,决定在build里设定加工属性
作者: ferarriii    时间: 2004-5-20 08:16
目前还不会,先帮你顶
作者: acoka    时间: 2004-5-21 17:09
解决了
解决了,公开CATIBuildShape部分程序供大家分享
  
// COPYRIGHT WSH 2004
//===================================================================
//
// WSHEDSPRTHPCHolePartBuildShape.cpp
// Provide implementation to interface
//    CATIBuildShape
//
//===================================================================
//
// Usage notes:  BuiltShape Inplement class
//
//===================================================================
//  May 2004  Creation: Code generated by the CAA wizard  zzsou1
//===================================================================
#include "WSHEDSPRTHPCHolePartBuildShape.h"
#include "CATIUpdateError.h"
#include "CATIGeometricalElement.h"
#include "CATISpecObject.h"
#include "CATMathDirection.h"
#include "CATIPrtFactory.h"
#include "CATISketchFactory.h"
#include "CATInit.h"
#include "CATListOfDouble.h"
#include "CATIMfProcReport.h"
#include "CATGeoFactory.h"
#include "CATSoftwareConfiguration.h"
#include "CATTopData.h"
#include "CATSolidCylinder.h"
#include "CATBody.h"
#include "CATDynBoolean.h"
#include "CATCGMJournalList.h"
#include "CATCGMJournalInfo.h"
#include "CATCGMJournalItem.h"
#include "CATIBRepAccess.h"
#include "CATMfBRepDecode.h"
#include "CATCell.h"
#include "CATFace.h"
#include "CATIContainerOfDocument.h"
#include "CATDocument.h"
  
#include "WSHIDSPRTHPCHolePart.h"
#include "WSHDSPRTHPCBuildErr.h"
#include "WSHDSPRTHPCListOfWSHIDSPRTHPCStage.h"
#include "WSHDSPRTHPCStage.h"
  
//debug
#include "CATIVisProperties.h"
#include "CATVisGeomType.h"
#include "CATVisPropertiesValues.h"
#include "CATIMechanicalTool.h"
  
#include "WSHCMNBdg.h"
  
CATImplementClass( WSHEDSPRTHPCHolePartBuildShape,
                   DataExtension,
                   CATBaseUnknown,
                   WSHDSPRTHPCHole );
   
//-----------------------------------------------------------------------------
// WSHEDSPRTHPCHolePartBuildShape : constructor
//-----------------------------------------------------------------------------
#define PCODE   1014005
#define  PNAME "WSHEDSPRTHPCHolePartBuildShape::WSHEDSPRTHPCHolePartBuildShape"
WSHEDSPRTHPCHolePartBuildShape::WSHEDSPRTHPCHolePartBuildShape():
    WSHCADCMNMDLExtIBuild()
{
  WSHCMNBdgintrtn( PCODE, PNAME);
}
  
//-----------------------------------------------------------------------------
// WSHEDSPRTHPCHolePartBuildShape : destructor
//-----------------------------------------------------------------------------
#undef  PNAME
#define  PNAME "WSHEDSPRTHPCHolePartBuildShape::~WSHEDSPRTHPCHolePartBuildShape"
WSHEDSPRTHPCHolePartBuildShape::~WSHEDSPRTHPCHolePartBuildShape()
{
  WSHCMNBdgintrtn( PCODE, PNAME);
}
   
// Tie the implementation to its interface
// ---------------------------------------
#include "TIE_CATIBuildShape.h"
TIE_CATIBuildShape( WSHEDSPRTHPCHolePartBuildShape);
//-----------------------------------------------------------------------------
// Implements CATIBuildShape::BuildShape
//-----------------------------------------------------------------------------
#undef  PNAME
#define  PNAME "WSHEDSPRTHPCHolePartBuildShape::BuildShape"
int WSHEDSPRTHPCHolePartBuildShape::BuildShape ()
{
  
  WSHCMNBdgintrtn( PCODE, PNAME);
  
  int Ret = 0;
  HRESULT rc = S_OK;
  do{
    // reset update error
    CATIUpdateError_var spUpdateError = this;
    if(!spUpdateError){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705001"));
      break;
    }
    spUpdateError->UnsetUpdateError();
  
    CATIGeometricalElement_var spGeomElement = this;
    if(!!spGeomElement){
      spGeomElement->DeleteScope();
    }
  
    // get feature attr
    WSHIDSPRTHPCHolePart_var spHolePart = this;
    if(!spHolePart){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705002"));
      break;
    }
    CATMathPoint OriginPoint = spHolePart->GetOrigin();
    CATMathDirection HolePartDirection = spHolePart->GetAxisDirection();
    double OffsetValue = spHolePart->GetOffsetValue();
    int StepValue = spHolePart->GetStepValue();
    CATRawColldouble* pDiamterValueList = spHolePart->GetDiameterValue();
    CATRawColldouble* pDepthValue = spHolePart->GetDepthValue();
  
    // get factory
    CATGeoFactory_var spGeoFactory = GetGeoFactory();
    if(!spGeoFactory){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705003"));
      break;
    }
    CATGeoFactory* pImpGeoFactory = spGeoFactory->GetImplicitGeoFactory();
    if( !pImpGeoFactory ) {
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705003"));
      break;
    }
  
    CATSoftwareConfiguration* pSoftwareConfiguration = new CATSoftwareConfiguration();
  
    // create dumy journal
    CATCGMJournalList* pJournalList = new CATCGMJournalList(
      pSoftwareConfiguration,
      NULL
    );
    if( !pJournalList ) {
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705004"));
      break;
    }
    CATTopData topData( pSoftwareConfiguration, pJournalList );
  
    // Get ProcReport
    CATIMfProcReport_var spProcReport = this;
    if(!spProcReport){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705005"));
      break;
    }
    CATLISTV(CATBaseUnknown_var) ListSpec;
    CATListOfCATUnicodeString    ListKeys;
    spProcReport->CreateProcReport(ListSpec,ListKeys,0);
  
    // real journal list
    CATCGMJournalList* pMainJournalList = spProcReport->GetCGMJournalList();
    if(!pMainJournalList){
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705005"));
      break;
    }
    CATSoftwareConfiguration* pSoftwareConfigurationMain = new CATSoftwareConfiguration();
    CATTopData topDataMain( pSoftwareConfigurationMain, pMainJournalList );
    CATLISTP(CATGeometry) operands;
  
    // create a temp stage info  
    CATLISTV(WSHIDSPRTHPCStage_var) StageListTemp;
  
    // face <-> Info index table
    int InfoIndex[1][4] = { 1, 1, 2, 0 }; // 0:頂面 1:側面 2:底面 999:無定義
  
    // Create cylinder soild
    CATBody_var spTotalBody = pImpGeoFactory->CreateBody();
    if ( !spTotalBody ) {
      rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705006"));
      break;
    }
    CATBody* pBoolResultBody = NULL;
    double OffsetStart = OffsetValue;
  
    for ( int iCnt = 1; iCnt <= StepValue ; iCnt++ ) {
      
      // create stage list
      WSHDSPRTHPCStage* pStage = new WSHDSPRTHPCStage();
      if( !pStage ) {
        rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705009"));
        break;
      }
      WSHIDSPRTHPCStage_var spStage = pStage;
      pStage->Release();
      pStage = NULL;
      if( !spStage ) {
        rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705009"));
        break;
      }
      
      // top center point
      if ( iCnt >1 ) {
        OffsetStart += (*pDepthValue)[iCnt-1];
      }
      CATMathPoint StartPoint( OriginPoint.GetX() + HolePartDirection.GetX()*OffsetStart,
                OriginPoint.GetY() + HolePartDirection.GetY()*OffsetStart,  
                OriginPoint.GetZ() + HolePartDirection.GetZ()*OffsetStart );
  
      // bottom center point
      double OffsetEnd = OffsetStart + (*pDepthValue)[iCnt];
      CATMathPoint EndPoint( OriginPoint.GetX() + HolePartDirection.GetX()*OffsetEnd,
                OriginPoint.GetY() + HolePartDirection.GetY()*OffsetEnd,  
                OriginPoint.GetZ() + HolePartDirection.GetZ()*OffsetEnd );
      
      // create cylinder
      CATSolidCylinder* pCylinder = NULL;
      CATTry{
        pCylinder = CATCreateSolidCylinder(pImpGeoFactory,
                           &topData,
                           StartPoint,
                           EndPoint,
                           (*pDiamterValueList)[iCnt]/2);
        if(!pCylinder){
          rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705007"));
          break;
        }
  
      }CATCatch(CATError, pError){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705007"));
        delete pCylinder;
        pCylinder = NULL;
        break;
      }CATEndTry;
  
      CATBody* pCylinderBody = pCylinder->GetResult();
      if(!pCylinderBody){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705007"));
        break;
      }
  
      CATBody_var spCylinderBody = pCylinderBody;
      if(!spCylinderBody){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705007"));
        break;
      }
      
      CATLISTP(CATCell) cellListFace;
      spCylinderBody->GetAllCells(cellListFace,2);
  
      // face index
      CATLISTV(CATBaseUnknown_var) WallList;
      CATLISTV(CATBaseUnknown_var) BottomList;
  
      for ( int iInfoCnt = 1; iInfoCnt<=cellListFace.Size(); iInfoCnt++ ) {
  
        CATFace* pFace = (CATFace*)cellListFace[iInfoCnt];
        if(!pFace){
          continue;
        }
        CATFace_var spFace = pFace;
        if ( !spFace ) {
          continue;
        }
        pMainJournalList->ReportCreation( operands, (CATGeometry*)pFace , new CATCGMJournalInfo( iCnt*10 + InfoIndex[0][iInfoCnt-1] ) );
  
      }
      spStage->SetWallBRepList( WallList );
      spStage->SetBottomBRepList( BottomList );
      StageListTemp.Append( spStage );      
  
      
      // get the sum body of cylindersる
      CATDynBoolean* pOperatorBool = CATCreateDynBoolean(pImpGeoFactory,
                         &topDataMain,
                         CATBoolUnion,
                         spTotalBody,
                         spCylinderBody);
  
      if(!pOperatorBool){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705008"));
        break;
      }
      CATTry{
        pOperatorBool->Run();
      }
      CATCatch(CATError,pError){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705008"));
        break;
      }
      CATEndTry;
  
      if ( !!pBoolResultBody ) {
        pImpGeoFactory->Remove( pBoolResultBody, CATICGMContainer::RemoveDependancies  );
        pBoolResultBody = NULL;
      }
      pBoolResultBody = pOperatorBool->GetResult();
      if(!pBoolResultBody){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705008"));
        break;
      }
      spTotalBody = pBoolResultBody;
      if(!spTotalBody){
        rc = CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705008"));
        break;
      }
  
      if(!!pOperatorBool){
        delete pOperatorBool;
        pOperatorBool = NULL;
      }
  
      if ( !!pCylinderBody ) {
        pImpGeoFactory->Remove( pCylinderBody, CATICGMContainer::RemoveDependancies  );
        pCylinderBody = NULL;
      }
  
      if(!!pCylinder){
        delete pCylinder;
        pCylinder = NULL;
      }
    } //for
  
    pMainJournalList->Tass();
    
    // pre-save face info before store a Journal
    int InfoArray[60] = { 0, 0 };
    CATLISTP(CATCGMJournal) ListOfCATFaceType;
    pMainJournalList->SearchReportsAbout(CATFaceType,ListOfCATFaceType);
    for ( int iCntList=1; iCntList<= ListOfCATFaceType.Size(); iCntList++) {
      if ( !(ListOfCATFaceType[iCnt]) ) {
        continue;
      }
      if ( (ListOfCATFaceType[iCntList])->GetType() == CATCGMJournal::Creation ) {
        CATCGMJournalItem* pJItem = (ListOfCATFaceType[iCntList])->CastToReportItem();
        if (!pJItem ) {
          continue;
        }
        const CATCGMJournalInfo* pJInfo = pJItem->GetAssociatedInfo();
        if ( !pJInfo ) {
          continue;
        }
        CATLONG32 InfoNum = pJInfo->GetNumber();
        if ( InfoNum < 10 || InfoNum > 59 ) {
          continue;
        }
        if ( InfoArray[InfoNum] ) {
          continue;
        }
        CATGeometry* pGeometry = pJItem->GetConstructedObject();
        if ( !pGeometry ) {
          continue;
        }
        CATGeometry_var spGeometry = pGeometry;
        if ( !spGeometry ) {
          continue;
        }
        // Set stage info
        int StageNumT = InfoNum/10;
        if ( InfoNum == StageNumT*10 ) continue;
        if ( InfoNum == StageNumT*10 + 1 ) {
          (StageListTemp[StageNumT])->WallBRepListAppend(spGeometry);
        }
        else {
          (StageListTemp[StageNumT])->BottomBRepListAppend(spGeometry);
        }
        InfoArray[InfoNum] = 1;
      }
    }
    
    // save ProcReport
    if( SUCCEEDED(rc) && spProcReport != NULL){
      spTotalBody->SetMode( CatCGMExplicit );
      spTotalBody->Completed( TRUE );         
      spProcReport->StoreProcReport(spTotalBody,NoCopy,0);  
    }
  
    // CATIContainerインターフェースを取得する
    CATILinkableObject_var spILinkableOnActive = this;
    if( !spILinkableOnActive ) {
      rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705010"));
      break;
    }
    CATDocument* pDocument = spILinkableOnActive->GetDocument();
    if ( !pDocument ) {
      rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705010"));
      break;
    }
    CATIContainerOfDocument* piContOfDoc = NULL;
    rc = pDocument->QueryInterface( IID_CATIContainerOfDocument, (void**)[$piContOfDoc )]
    if( FAILED(rc) || !piContOfDoc ) {
      rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705010"));
      break;
    }
    CATIContainerOfDocument_var spContOfDoc = piContOfDoc;
    piContOfDoc->Release();
    piContOfDoc = NULL;
    if ( !spContOfDoc ) {
      rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705010"));
      break;
    }
    CATIContainer* pCont = NULL;
    rc = spContOfDoc->GetBRepContainer(pCont);
    if ( FAILED(rc) || !pCont ) {
      rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705010"));
      break;
    }
    CATIContainer_var spCont = pCont;
    if ( !spCont ) {
      rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705010"));
      break;
    }
  
    // Stage List
    CATLISTV(WSHIDSPRTHPCStage_var) StageList;
  
    // decode fave info to Brep
    for ( int iStepNum = 1; iStepNum <= StageListTemp.Size(); iStepNum++ ) {
      // caeate stage info
      WSHDSPRTHPCStage* pStage = new WSHDSPRTHPCStage();
      if( !pStage ) {
        rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705009"));
        break;
      }
      WSHIDSPRTHPCStage_var spStage = pStage;
      pStage->Release();
      pStage = NULL;
      if( !spStage ) {
        rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705009"));
        break;
      }
  
      // INdex face( in BRep)
      CATLISTV(CATBaseUnknown_var) WallBRepList;
      for ( int iWallCnt = 1; iWallCnt <= ((StageListTemp[iStepNum])->GetWallBRepList()).Size(); iWallCnt++ ) {
        CATIBRepAccess_var spIBRepAccess = CATBRepDecode(  spCont,
                                  ((StageListTemp[iStepNum])->GetWallBRepList())[iWallCnt],
                                  spTotalBody );
        if ( !spIBRepAccess ) {
          rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705011"));
          break;  
        }
        WallBRepList.Append(spIBRepAccess);
        
//dubug
        int iMACopyFlag = spHolePart->GetMACopyFlag();
        if ( spHolePart->GetMACopyFlag() ) {
           CATIVisProperties *piGraphProp = NULL;
           rc = spIBRepAccess->QueryInterface( IID_CATIVisProperties,  
                                   (void**)[$ piGraphProp)]
           if ( FAILED(rc) ) {
             break;
           }
           CATVisPropertiesValues Attribut;
           Attribut.SetColor(255, 255, 0); // yellow
           piGraphProp->SetPropertiesAtt(Attribut, CATVPColor , CATVPMesh );
           piGraphProp->Release();
           piGraphProp = NULL ;
        }
      }
      spStage->SetWallBRepList( WallBRepList );
  
      CATLISTV(CATBaseUnknown_var) BottomBRepList;
      for ( int iBottomCnt = 1; iBottomCnt <= ((StageListTemp[iStepNum])->GetBottomBRepList()).Size(); iBottomCnt++ ) {
        CATIBRepAccess_var spIBRepAccess = CATBRepDecode(  spCont,
                                  ((StageListTemp[iStepNum])->GetBottomBRepList())[iBottomCnt],
                                  spTotalBody );
        if ( !spIBRepAccess ) {
          rc =  CATReturnError(new WSHDSPRTHPCBuildErr("WSHEDSPRTHPCHolePartBuildShapeErr_1001705011"));
          break;  
        }
        BottomBRepList.Append(spIBRepAccess);
//dubug
        int iMADispFlag = spHolePart->GetMADispFlag();
        if ( spHolePart->GetMADispFlag() ) {
          CATIVisProperties *piGraphProp = NULL;
          rc = spIBRepAccess->QueryInterface( IID_CATIVisProperties,  
                                   (void**)[$ piGraphProp)]
          if ( FAILED(rc) ) {
             break;
          }
          CATVisPropertiesValues Attribut;
          Attribut.SetColor(0, 255, 255); // yellow
          piGraphProp->SetPropertiesAtt(Attribut, CATVPColor , CATVPMesh );
          piGraphProp->Release();
          piGraphProp = NULL ;
        }
      }
      spStage->SetBottomBRepList( BottomBRepList );
      StageList.Append(spStage);
  
    } //for
  
    //  
    // FunFromMaTeam( spHolePart->GetCircle(), StageList, spHolePart->GetMACopyFlag(), spHolePart->GetMADispFlag() );
  
  } while ( FALSE );
  
  SUCCEEDED( rc ) ? Ret = 1 : Ret = 0 ;
  return Ret;
}
作者: acoka    时间: 2004-5-21 17:44
这个程序的功能是画下面这个多段孔
并保留各个面的情报,
差的bool计算和颜色,加工属性的设定是呼叫别的class
作者: suilj    时间: 2004-5-26 20:48
佩服!




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3