|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 b& X d8 I8 Z* E4 Y0 t- Z 可能大家用的到,选择一条曲线,通过输入的公差,自动创建一些列的点集!& Y0 _ T* C1 q6 s, a8 U o
% L& x" N0 `) F- q6 q" N# N
& i$ W! p/ C: ~+ s* _' ivoid testSimulation::do_it()+ t2 l0 c; H. z% z
{0 S/ R# \3 I+ T- L
//TaggedObject* toolbody = select_by_mask();
2 e- k8 J) P6 M0 D- c5 g! ~ TaggedObject* pathCurve = select_by_type();: J6 @- A {1 e
//std::vector< NXOpen::TaggedObject * > any_objs = select_any_objects();
9 q4 T! q A( h+ k: W // get the path point
' Q( l! O: N! B0 I' L- ] double ctol = 0.0;
$ F1 q4 {$ a j* r8 L) E double atol = 0.0;
" Y# x% L( @& P: C6 M double stol = 10.0;
+ u+ B! k2 H: }& ^; _& x1 A3 s' S0 } double *pts;
r g( @/ e, V2 I int num =0;
' ^5 ?/ l8 z, A! o char msg[256];& \" p8 i4 r) n* }
int error =0;- R% D, c! D1 N$ Z
double (*points)[3];
$ X# I4 {0 N6 g( `2 i8 u tag_t pointTag;
3 Q6 }* }) U' j1 h8 S2 e: w 1 L; k% D5 E% E; r' W
8 s6 z# z8 E6 U% h/ w- S UF_initialize();0 Q/ R1 l, O7 C# q1 }6 K. Y
0 |$ M" `9 w8 Z% \
UF_MODL_ask_curve_points(pathCurve->Tag(),ctol,atol,stol,&num,&pts);
; s( _5 T* Z' c7 O' X sprintf(msg,"the number of points:%d",num);
1 g; u( N& ~0 z% b" p print(msg);: X) y, j- ^+ E& M
& d* w5 A- Y* L$ }+ u! I5 E points = (double(*)[3])(UF_allocate_memory(num*sizeof(double[3]),&error));. o& o$ O4 v" u; B" s
3 q2 l8 m- y8 `7 Z6 x# Y) }: x# o/ ~
for(int i =0 ; i < 3*num;++i)
, n3 Z1 B, f1 A! y6 l7 \ {' u$ l. c- d* [, w' |8 L2 m
sprintf(msg,"The points are: %f\n",pts[i]);7 v4 o1 u |6 w& K
print(msg);
0 I2 u( ~# x, v3 S0 {4 e
& u8 |1 [9 [& Z4 v# o+ N }
' B3 h7 h/ q. Y: Q8 W& E6 P for (int j = 0; j < num; j++)4 C) S' O8 Y6 ]: T
{2 b4 {% R/ M4 E, e2 n/ N8 |
points[j][0] = pts[j*3];
( g. G8 |- M- m* ~5 n points[j][1] = pts[j*3+1];
, c. X3 A; Y9 {4 y, _4 n4 r( e7 C points[j][2] = pts[j*3+2];
1 O& `& ]0 U5 [7 |. Q& X UF_CURVE_create_point(points[j],&pointTag);; ^" P. {* l l9 P$ c F: M
}& U; M2 ?. |& b8 y, e
; i7 x2 f( g8 @7 r, S
UF_free(points);! H* } w6 V3 P+ q/ ~0 q& y; Q+ J
UF_free(pts);) B# o; I7 M3 t8 i0 q
UF_terminate();" c; s% `" X) h. s
5 T& s) o/ o0 A# J
// TODO: add your code here( \% {% ?2 Y& j7 c! X
`2 {+ E) q7 l& t4 w. T" F}# `! { Q& A% g+ c
w1 R* f: R6 [- b/ \$ o7 t# X0 I$ ]
|
|