iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 25261|回复: 5
打印 上一主题 下一主题

【求助】谁告诉我catia里如何获得自己改写过的JournalList

[复制链接]
跳转到指定楼层
楼主
发表于 2004-5-18 17:21:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
我在做一个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;
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
 楼主| 发表于 2004-5-19 19:27:35 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
板凳
发表于 2004-5-20 08:16:57 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
地板
 楼主| 发表于 2004-5-21 17:09:04 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
5
 楼主| 发表于 2004-5-21 17:44:53 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

1925234-1-embed.JPG (54.06 KB, 下载次数: 34)

阅读权限: 1

1925234-1-embed.JPG
6
发表于 2004-5-26 20:48:21 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-11-16 08:07 , Processed in 0.015396 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表