教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 资格考试 >

CATIA CAA 二次开发 详细教程(5)添加一个点(2)

来源:网络收集 时间:2026-01-25
导读: CATIA CAA 二次开发 详细教程 CATI2DCurve_var spCurve2 (spLine2); CATI2DCurve_var spCurve3 (spLine3); CATI2DCurve_var spCurve4 (spLine4); spCurve1->SetStartPoint(spPt_bottom_left); spCurve1->SetEndPoin

CATIA CAA 二次开发 详细教程

CATI2DCurve_var spCurve2 (spLine2); CATI2DCurve_var spCurve3 (spLine3); CATI2DCurve_var spCurve4 (spLine4);

spCurve1->SetStartPoint(spPt_bottom_left); spCurve1->SetEndPoint(spPt_bottom_right); spCurve2->SetStartPoint(spPt_bottom_right); spCurve2->SetEndPoint(spPt_top_right); spCurve3->SetStartPoint(spPt_top_right); spCurve3->SetEndPoint(spPt_top_left); spCurve4->SetStartPoint(spPt_top_left); spCurve4->SetEndPoint(spPt_bottom_left); 然后退出草图:

spSketch->CloseEdition();

CATIA CAA 二次开发 详细教程(9)创建圆角三角形

1)创建三个点(参见教程5) 2) 将点连成线(参见教程6)

3) 通过三点创建一个参考平面,后面进行圆弧倒角时要用到该平面。 CATIGSMPlane3Points_var Supportplane = spGSMFactory->CreatePlane(spPoint1, spPoint2,spPoint3);

CATISpecObject_var spSupportplane = Supportplane; 4) 创建倒角半径的参数:

CATICkeParm_var Radius1 = NULL_var;

CATICkeMagnitude_var spRadMag = spParamDictionary->FindMagnitude(\GTH\

CATUnicodeString name(\

Radius1 = spParmFactory->CreateDimension(spRadMag,name, .01); 5) 创建倒角::

CATIGSMCorner_var Corner1 = spGSMFactory->CreateCorner(spLine1, spLine2, spSupportplane, Radius1,

CATGSMSameOrientation, CATGSMSameOrientation, FALSE);

CATISpecObject_var spCorner1 = Corner1;

35

CATIA CAA 二次开发 详细教程

6) 裁剪去多余的线和点:

CATIGSMSplit_var Split1 = spGSMFactory->CreateSplit(spLine1, spRadius1,

CATGSMSameOrientation);

CATISpecObject_var spSplit1 = Split1;

CATIGSMSplit_var Split1a = spGSMFactory->CreateSplit(spSplit1, spRadius3,

CATGSMInvertOrientation);

CATISpecObject_var spSplit1a = Split1a; 7) 将线和圆弧依次连接起来,创建一个序列: CATLISTV(CATISpecObject_var) joincurves; joincurves.Append(spSplit1a); joincurves.Append(spSplit2a); joincurves.Append(spSplit3a); joincurves.Append(spRadius1); joincurves.Append(spRadius2); joincurves.Append(spRadius3);

8)在讲序列连接起来之前,需要创建一个最小的结合距离: CATICkeParm_var Mergedist = NULL_var;

CATICkeMagnitude_var spMergedist = spParamDictionary->FindMagnitude(\LENGTH\

CATUnicodeString mergename(\

Mergedist = spParmFactory->CreateDimension(spMergedist, mergename, .0001);

9)连接起来并插入到视图中:

Now we can join this list of objects into a single shape and insert it into the part.

CATIGSMAssemble_var CurveAssy = spGSMFactory->CreateAssemble(joincurves, Mergedist, FALSE);

CATISpecObject_var spCurveAssy = CurveAssy;

spCurveAssy->Update();

CATIGSMProceduralView_var spCurObj = Curveassembly;

36

CATIA CAA 二次开发 详细教程

spCurObj->InsertInProceduralView();

CATIA CAA 二次开发详细教程(10) 文档操作方法 创建 加载 保存

一、创建(Create the new document)

CATDocument* pDoc = NULL;

rc = CATDocumentServices::New(\ if (NULL != pDoc) {

cout << \ } else {

cout << \ return 2; }

Now that the session is opened, you can create a new document using the New static method of CATDocumentServices. This method creates a document and initializes it, allowing it to be loaded and stored and making it editable. In this use case, a pre-defined document type, \is used as a document type. In interactive mode, this is the name that appears when performing a File/New operation. It is not the file extension, which, in this case, is \

二、打开(Load the document)

37

CATIA CAA 二次开发 详细教程

CATDocument *pDoc = NULL;

rc = CATDocumentServices::Open(argv[1], pDoc); if (SUCCEEDED(rc) && (NULL != pDoc)) {

cout << \ } else {

cout << \ return 2; }

Now that the session is opened, you can load an existing document using the Ope

n static method of CATDocumentServices. This method needs, as a first parameter, the

entire storage path name and document name of the existing document that we want to load into the session. In this use case, we enter this information as an argument to the program. The second parameter of the Open method returns a CATDocumentpointer to the document it has loaded.

Once the document exists in the session, you can work with objects within it, using specific interfaces external to the ObjectModelerBase framework.

三、获取当前文档

CATFrmEditor * pEditor = GetEditor(); if (NULL != pEditor ) {

cout << \ } else {

cout << \ return 1; }

CATDocument *pDoc = pEditor->GetDocument(); if (NULL != pDoc) {

cout << \ } else {

cout << \ return 2; }

38

CATIA CAA 二次开发 详细教程

四、提取根容器(Retrieving the Document Root

Container)

CATInit *piInitOnDoc = NULL;

rc = pDoc -> QueryInterface (IID_CATInit, (void**) &piInitOnDoc); if (FAILED(rc)) {

cout << \ return 3; }

const CATIdent idCATIContainer = \ CATIContainer *piRootContainer = NULL;

piRootContainer = (CATIContainer*) piInitOnDoc -> GetRootContainer(idCATIContainer);

if (NULL == piRootContainer) {

cout << \ return 4; }

The document root container is retrieved using the CATInit::GetRootContainer method. The CATIContainer handle retrieved through GetRootContainer will be necessary whenever you want to create or manipulate objects in the document.

五、保存文档(Save the Document)

5.1 另存

rc = CATDocumentServices::SaveAs (*pDoc, argv[1]); if (SUCCEEDED(rc)) {

cout << \ } else {

cout << \ return 5; }

To save the new document, use the SaveAs static method of CATDocumentServices. This method takes the pointer to the document created by New as a first parameter, and the storage path name and document name under which the document is to be stor

39 < …… 此处隐藏:2786字,全部文档内容请下载后查看。喜欢就下载吧 ……

CATIA CAA 二次开发 详细教程(5)添加一个点(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/412017.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)