|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 b. k7 b6 x8 y4 ~7 ?0 ?* t0 y 可能大家用的到,选择一条曲线,通过输入的公差,自动创建一些列的点集!$ M7 T! G* { u
1 {. a# u8 i* q5 ^, L" T! N& W! d. o& E9 `% d
void testSimulation::do_it()% d$ K: J1 C r+ \' F, ]/ y
{
. E' {/ C) b9 C) y8 B //TaggedObject* toolbody = select_by_mask();
7 [8 X3 [) ^. B/ k( q3 U TaggedObject* pathCurve = select_by_type();2 l5 f5 w, k! |2 s$ z
//std::vector< NXOpen::TaggedObject * > any_objs = select_any_objects();( O! K* _% j: T E/ S
// get the path point X4 D0 b# S! s! k* J9 o6 W
double ctol = 0.0;3 s9 w' V& P' k$ ~+ {
double atol = 0.0;
8 q, t; r% J' D4 P c double stol = 10.0;
9 U* M/ d+ y% s" y8 J double *pts;1 p$ @/ Z! y6 }+ |* N" A
int num =0;/ g s1 H! P) M, I; ^
char msg[256];1 h( _) D( W( |, q
int error =0;8 r ]+ `; ]/ Z* n9 Y) z
double (*points)[3];
6 @8 S: @8 {8 [ tag_t pointTag;
" h- Q8 \. I& `& I a, J, w2 G 9 V' P/ v6 ?# f3 _
3 n' V, |2 ^* U UF_initialize();4 [+ s5 O" J( ]( ?' Z
; `4 h- K; K/ l2 [, X UF_MODL_ask_curve_points(pathCurve->Tag(),ctol,atol,stol,&num,&pts);
% h* {6 [5 g) u2 L sprintf(msg,"the number of points:%d",num);
! [% z" }. C" {: C print(msg);: \0 e4 Y& z& S: q! o
' l& u5 U( `- S4 u& V& ~6 {8 [
points = (double(*)[3])(UF_allocate_memory(num*sizeof(double[3]),&error));8 t" n% I _, P, ?! W A
" B3 r2 p+ r! g
for(int i =0 ; i < 3*num;++i)
4 j5 y3 z3 ~" Y5 N% M8 {' Y2 W {
6 b( L! b; Q- z3 Z sprintf(msg,"The points are: %f\n",pts[i]);: g! [1 [) h) G5 b$ F. N
print(msg);
$ [- {3 U9 l/ S! e( F7 h , H- b1 C& |' I M
}
( t0 x. k4 o; i1 T for (int j = 0; j < num; j++)/ c& f; r+ d6 |0 Z1 K: [
{7 B! W. s7 W2 L- j) t) I% q
points[j][0] = pts[j*3];! \8 h: c. q/ e/ e" k0 n
points[j][1] = pts[j*3+1];- u# E/ S0 j1 o& R
points[j][2] = pts[j*3+2];4 o5 d4 B9 ^; _" j0 d6 w [* W; I
UF_CURVE_create_point(points[j],&pointTag);
8 Y o; v3 ]. ]- M; T, i }
8 q' }, L: T% |3 z: v
0 K) C! ~8 O' }+ y( q UF_free(points);4 G" Q6 M( E* L1 @9 P c3 c& }
UF_free(pts);
4 q" m6 y9 F( [" Q2 ~/ p# _: p* ] UF_terminate();* J9 [& D+ ]( y9 K! K* w
7 b' q( Q, j1 N% ^8 R: ^ // TODO: add your code here
4 ]7 }! f- |) f% ^: Q0 O
; \7 M& }& |. d* T9 f$ r( z}- c. W) |) ` ~: o1 V/ \2 B
! B" H! D2 S0 X1 s2 k
|
|