PLM之家PLMHome-国产软件践行者

[资料] CATIA二次开发入门教程---19 创建一条线

[复制链接]

2017-12-22 11:06:27 3671 1

admin 发表于 2017-12-22 11:05:33 |阅读模式

admin 楼主

2017-12-22 11:05:33

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

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

x
CATIA二次开发入门教程---19 创建一条线
* }) z) p8 C1 e% G& c! ?3 i( G% T2 p! u. h5 h& o/ Z
[mw_shl_code=c,true]
: o: V- e* @, ?$ P, z        CATFrmEditor *pEditor = CATFrmEditor::GeTCurrentEditor();. J$ P" m$ [" d
        CATDocument *pDoc = pEditor->GetDocument();
; T7 y5 |/ ]4 d3 {        CATIContainerOfDocument_var spConOfDoc = pDoc;6 Z% j9 X+ V* H; z7 F0 ~
        if (spConOfDoc == NULL_var)
8 J. S9 f* z) j2 D        {2 x5 F# O: R: [" e/ h! G
                popUpNotifyDialog("No spConainer of document");" `5 S2 ^7 ]4 E  h
        }
2 B' U' q( T# K% Y+ J* `$ Y/ F        CATIContainer *pCon = NULL;
! A/ {$ Q2 H3 ^; c4 Q# Z        HRESULT hr = spConOfDoc->GetSpecContainer(pCon);0 ?! X5 d5 b8 t2 P2 |( D
4 }) P7 i7 K2 ^1 s) e5 c
        //get GSM factory9 a) x# `! w& v6 [

! ]: ~; d1 u3 O8 a0 u    CATMathPoint p1,p2;
3 n1 ]( B3 U6 g: f1 S5 R& g        p1.SetCoord(0,0,0);
9 i6 [4 j- r/ q/ L        p2.SetCoord(10,10,10);6 `# ]! M, \* S. o' Q* r; W
       
$ f5 M, S; `  S  T, F/ ?6 |  ~/ j3 S% C
     CATIGSMFactory_var spGSMFactory = pCon;. }1 t0 `; G: c+ F
  9 T' ^2 E7 H  M/ V
         CATIGSMPoint_var  spP1 = spGSMFactory->CreatePoint(p1,"");  p. d: j* O) _0 T4 V
         CATIGSMPoint_var  spP2 = spGSMFactory->CreatePoint(p2,"");, {# K$ Y, n+ `, B: t. b& o
     
1 ]3 F8 t- ]- [1 g) N  CATIGSMLinePtPt_var spLine =  spGSMFactory->CreateLine(spP1,spP2,NULL_var);+ P& A" Z# e8 p

+ R1 \, g4 Q* v4 ?) X- E) o  CATISpecObject_var spSpecObject = spLine;% t$ a# }7 U# |  ]. m& _, s5 n
  CATIGSMProceduralView_var spGSMProceduralView = spSpecObject;
0 @. h' w1 \; ^: U* @
$ x, f- B! P' k7 @  spGSMProceduralView->InsertInProceduralView();; M, x- K4 k% Q& I8 e& O

; ~) [* N1 i4 L  l* w3 p- h) ^2 g) r  spSpecObject->Update();[/mw_shl_code]
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

全部回复1

admin 发表于 2017-12-22 11:06:27

admin 沙发

2017-12-22 11:06:27

在此基础上,创建线的步骤如下:
1)创建两个点并将其转换为CATISpecObjects。
double Coords[3];
Coords[0] = 0;
Coords[1] = 0;
Coords[2] = 0;
CATIGSMPoint_var spPoint1 = spGSMFactory->CreatePoint(Coords); CATISpecObject_var spSpecPoint1 = spPoint1;                  
Coords[0] = 8;
Coords[1] = 6;
Coords[2] = 7;
CATIGSMPoint_var spPoint2 = spGSMFactory->CreatePoint(Coords);
CATISpecObject_var spSpecPoint2 = spPoint2;
2) 利用创建的点创建一条线,并将其转换为CATISpecObject
CATISpecObject_var  spSupport = NULL_var;
CATIGSMLinePtPt_var spLine1 = spGSMFactory->CreateLine(spSpecPoint1, spSpecPoint2, spSupport);
CATISpecObject_var spSpecLine1 = spLine1;
3) 更新创建的线,并将其添加到视图中。
spSpecLine1->Update();
CATIGSMProceduralView_var spCurObj = spLine1;
spCurObj->InsertInProceduralView();
" s" {. u7 p9 q% o! q& f. D# H- }
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复 支持 反对

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了