CATIA技术交流论坛

 找回密码
 点击注册
查看: 385|回复: 0

CATIA CAA 二次开发详细教程 第八讲:草图上创建几何图形

[复制链接]

1684

主题

1726

帖子

4266

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4266
发表于 2018-1-26 14:07:49 | 显示全部楼层 |阅读模式
在上一节的基础上,开始创建草图。首先创建草图工厂:
CATI2DWFFactory_var sketch2DFactory(spSketch); 下面创建点:
CATI2DPoint_var spPt_bottom_left, spPt_bottom_right, spPt_top_right, spPt_top_left;
double pt_bottom_left[2]  = {10., 10.};
double pt_bottom_right[2] = {50., 10.}; double pt_top_right[2]    = {50., 50.}; double pt_top_left[2]     = {10., 50.};
spPt_bottom_left  = sketch2DFactory->CreatePoint(pt_bottom_left); spPt_bottom_right = sketch2DFactory->CreatePoint(pt_bottom_right);
spPt_top_right    = sketch2DFactory->CreatePoint(pt_top_right); spPt_top_left     = sketch2DFactory->CreatePoint(pt_top_left); 开始创建线:
CATI2DLine_var spLine1, spLine2, spLine3, spLine4;
spLine1 = sketch2DFactory->CreateLine(pt_bottom_left,pt_bottom_right);
spLine2 = sketch2DFactory->CreateLine(pt_bottom_right,pt_top_right);
spLine3 = sketch2DFactory->CreateLine(pt_top_right,pt_top_left); spLine4 = sketch2DFactory->CreateLine(pt_top_left,pt_bottom_left);
将线连接起来:
CATI2DCurve_var spCurve1 (spLine1); 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技术交流论坛

GMT+8, 2019-12-16 00:50 , Processed in 0.025627 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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