NX二次開発-NXOpen :: CoordinateSystemCollectionクラスリファレンス

1 NX11 + VS2013
 2  
3  
4の#include <NXOpen / Section.hxx>
 5の#include <NXOpen / SectionCollection.hxx>
 6の#include <NXOpen / Part.hxx>
 7の#include <NXOpen / PartCollection.hxx>
 8の#include <NXOpen /CoordinateSystem.hxx>
 9の#include <NXOpen / CoordinateSystemCollection.hxx>
 10の#include <NXOpen / CartesianCoordinateSystem.hxx>
 11の#include <NXOpen / NXMatrix.hxx>
 12の#include <NXOpen / NXMatrixCollection.hxx>
 13の#include <NXOpen /Xform.hxx>
 14の#include <NXOpen / XformCollection.hxx>
 15#include <NXOpen / Scalar.hxx>
 16の#include <NXOpen / ScalarCollection.hxx>
 17の#include <NXOpen / CylindricalCoordinateSystem.hxx>
 18の#include <NXOpen / UI.hxx>
 19の#include <NXOpen / NXMessageBox.hxx>
 20  
21  
22は 使用して 名前空間をNXOpen。
23  使って 名前空間はstdを、
24  
25  
26      NXOpen ::セッション* theSession = NXOpen ::セッション::のgetSession()。
27      NXOpen ::パート* workPart(theSession->パーツ() - > ワーク());
28      NXOpen ::パート* displayPart(theSession->パーツ() - > ディスプレイ());
29  
30     // (、システムが一時的な使用TRUE座標部材に表示も格納されない場合、TRUEおよびFALSE)新たな直交座標系を作成し
31である      Point3dとWcsOrigin1(100.0100.0100.0); / / 起源
32      MATRIX3X3 WcsMatrix1(100010001); // マトリックス
33は      NXOpen CartesianCoordinateSystem :: = * WcsNew1 workPart-> CoordinateSystems() - > CreateCoordinateSystem(WcsOrigin1、WcsMatrix1、 FALSE);
 34  
35      // 新たな直交座標系を作成します
36      Point3dとWcsOrigin2(200.0200.0200.0); // 原点
37      のVector3D xDirection2(1.00.00.0); // ベクトル
38である      のVector3D yDirection2(0.01.00.0 );
 39      NXOpen CartesianCoordinateSystem :: = * WcsNew2 workPart-> CoordinateSystems() - > CreateCoordinateSystem(WcsOrigin2、xDirection2、yDirection2);
 40  
41      // TRUEとFALSE新しいデカルト座標系を(作成、システムがTRUE一時的に使用される座標あれば、それは表示されません、それは保存されません部材)で
42である      Point3dとWcsOrigin3(300.0300.0300.0); // 原点
43である      MATRIX3X3 WcsMatrix3(100010001); // マトリックス
44は      NXOpen Matrix3 :: = * NXMatrix workPart-> NXMatrices()は- >(WcsMatrix3)を作成し; //は新しいマトリックス作成
45      NXOpen CartesianCoordinateSystem :: = * WcsNew3 workPart-> CoordinateSystems() - > CreateCoordinateSystem(WcsOrigin3、FALSE Matrix3を、);
 46れる 
47      // 新たな直交座標を作成します部門
48      Point3dとWcsOrigin4(400.0400.0400.0)。// 原点
49      のVector3D xDirection4(1.00.00.0); // 向量
50      のVector3D yDirection4(0.01.00.0 )。
51      ダブルスケール= 1 52      NXOpen ::変形移動*のXForms = workPart-> XFormsの() - > CreateXform(WcsOrigin4、xDirection4、yDirection4、SmartObject :: UpdateOptionWithinModeling、スケール)。
53     CartesianCoordinateSystem :: = * WcsNew4 NXOpen workPart-> CoordinateSystems() - > CreateCoordinateSystem(のXForms、SmartObject :: UpdateOptionWithinModeling);
 54である      WcsNew4-> setVisibility(SmartObject :: VisibilityOptionVisible); // 設定された表示座標    
 55  
れる56      // 新規作成円筒座標系
57で      Point3dとWcsOrigin5(500.0500.0500.0); // 原点
58      のVector3D xDirection5(1.00.00.0); // ベクトル
59      のVector3D yDirection5(0.01.00.0 );
 60      NXOpen CylindricalCoordinateSystem :: = * WcsNew5 workPart-> CoordinateSystems() - > CreateCylindricalCoordinateSystem(WcsOrigin5、xDirection5、yDirection5);
 61は 
62である     // 座標系が一時的である場合、座標系を新たな円筒形を作成し(TRUEおよびFALSE TRUEと、メンバーに表示も保存されません)
63である      Point3dとWcsOrigin6(600.0600.0600.0); // 原点
64      MATRIX3X3 WcsMatrix6(100010001); //マトリックス
65      NXOpen :: NXMatrix * Matrix6 workPart- => NXMatrices() - >(WcsMatrix6)を作成します; // 新しいマトリックスを作成する
66      NXOpen :: CylindricalCoordinateSystem * WcsNew6 workPart- => CoordinateSystems() - > CreateCylindricalCoordinateSystem(WcsOrigin6、Matrix6 )、FALSE;
 67  
68      // 新たな円筒座標系の作成
69      Point3dとWcsOrigin7(700.0700.0700.0の); // 原点
70      のVector3D xDirection7(1.00.00.0); // ベクトル
71である      のVector3D yDirection7(0.01.00.0 );
 72      ダブル Scale7 = 1。;
 73れる      変形移動:: = * xform7 workPart-> XFormsの()NXOpen - > CreateXform(WcsOrigin7、xDirection7、yDirection7、SmartObject :: UpdateOptionWithinModeling、Scale7)を、
 74      NXOpen :: * WcsNew7 CylindricalCoordinateSystem workPart- => CoordinateSystems() - > CreateCylindricalCoordinateSystem(xform7、SmartObject :: UpdateOptionWithinModeling);
 75      WcsNew7-> setVisibility(SmartObject :: VisibilityOptionVisible); // 設定された表示座標
 76回の 
77      // すべての座標系を反復を
78      ベクトル< tag_t> AllCoordVector; // 定義されたベクトル
79     :: * AllCoord座標系NXOpen; // 定義型
80      NXOpen CoordinateSystemCollection :: ::イテレータITE; // イテレータ定義
81の     ための(ITE = workPart-> CoordinateSystems() - >開始();! = ITE workPart-> CoordinateSystems () - >エンド(); ++ ITE)
 82      {
 83          AllCoord =(* ITE);
 84          AllCoordVector.push_back(AllCoord->タグ()); // 取得した座標がタグ
85      }
 86  
87      チャー MSG [ 256 ];
 88      sprintf_s(MSG、" 座標系の数:Dの%" 、AllCoordVector.size());
 89     :: getUI UI() - > NXMessageBox() - >ショー(" タイトル" 、NXMessageBox :: DialogTypeWarning、MSG);
 90  
91  
92  シーザー呂上虞
 93 2019年8月31日

おすすめ

転載: www.cnblogs.com/nxopen2018/p/11440738.html