|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
# s- S, z, z7 F 可能大家用的到,选择一条曲线,通过输入的公差,自动创建一些列的点集!
3 K7 S4 w* T" K7 L3 r) c: q8 i; X) k* b6 H& B$ |
( k! O+ A. n. q: D- r' q; q2 S4 V: ?void testSimulation::do_it()
# w/ `3 g) l% n: e6 N{* e* b$ H! \0 X* F2 ~6 \3 O! M
//TaggedObject* toolbody = select_by_mask();
* |% {0 u7 L/ V B TaggedObject* pathCurve = select_by_type();
7 N+ v6 b7 J8 X; C9 c+ P' C //std::vector< NXOpen::TaggedObject * > any_objs = select_any_objects();" \* y' o; n5 ]* _( t# N/ R
// get the path point
5 F% n+ J/ S- {: \# v double ctol = 0.0;
4 i- E. P- Z) d. J9 r+ Q2 N double atol = 0.0;
5 |. w7 l' D( m9 Z- q double stol = 10.0;& C3 p. n3 W2 {& E% c# ?
double *pts;7 b2 V" x. T6 q% W q! j+ O. Z6 {
int num =0;
+ H: w& E* o! P( }. c& `2 y: s# V char msg[256];: e! ]9 C: y, u* U0 V+ g9 O
int error =0;
* k( I) D% f" I6 s double (*points)[3];- ]1 W- a" Y7 b
tag_t pointTag;
L. F! _' e4 ]. t
5 t0 H' e1 Y6 Z% V8 R3 \& P/ K- x+ N1 i3 P
UF_initialize();5 T5 r5 q) e( Z4 K( M
5 F- ]8 W5 P' e* {+ @7 ] UF_MODL_ask_curve_points(pathCurve->Tag(),ctol,atol,stol,&num,&pts);8 @+ O( I5 m) y
sprintf(msg,"the number of points:%d",num);% h* N7 X& _- j6 J! Q" W
print(msg);
6 ~# l- w9 b( j$ V
8 ] e {8 A- ~+ x# O. X1 e& v points = (double(*)[3])(UF_allocate_memory(num*sizeof(double[3]),&error));% U& @; {3 o5 z) s/ e
% Z8 s$ y! w( L: y for(int i =0 ; i < 3*num;++i)
) r1 f3 U- o$ p' J {
: v: \) n: i: Q# S sprintf(msg,"The points are: %f\n",pts[i]);
& A3 c% d1 G! Q, p% A s print(msg);6 @; K) z; Z! w$ {2 U2 |
2 u9 ?9 U$ m5 l7 R q8 Y, m
}
4 [: L1 S' V& W: O9 _" M( A% b for (int j = 0; j < num; j++), ]* U* x. W" A, t! K: M
{
& M* b$ B7 T: k# f9 N: o points[j][0] = pts[j*3];
$ {" `, v: x+ v K4 o2 K# ^ points[j][1] = pts[j*3+1];# W# E( d4 I8 f! ~5 S0 d' c! u- M ~
points[j][2] = pts[j*3+2];
; M, w' I4 N7 u W+ S) Z$ P UF_CURVE_create_point(points[j],&pointTag);" m( I, M3 H" I3 A$ ?5 X3 l: `
}, s5 u. x0 W8 H/ `3 C& }
) H" A( \5 W% M$ e
UF_free(points);
4 ^. `2 Q5 S' W) K UF_free(pts);9 c. T; E% U# V' C, z& A# @; e
UF_terminate();- ]' f n3 `! H Z0 d6 |% y! A7 k2 \
8 r: R6 k8 N" K
// TODO: add your code here
! n% G7 h4 `( ?
9 M" }/ Y1 V/ ~7 k3 {1 y& @! ~2 w}
$ b u: C9 ]: I; U" y" s) ` t Q! z4 G* \
|
|