|
利用的是函数UF_CURVE_create_ocf_feature();
% v* D, l9 q g: ~. E V! h- R: ]. t函数里面的参数有一个是表示偏置曲线的tag_t类型的参数,还有一个是表示曲面的tag_t类型的参数,但是我将曲线曲面的ID带入,怎么都得不到正确的结果。后来在文档中发现表示偏置曲线tag_t类型的参数必须是一个string,而曲面必须是一个face collector。那么如何将曲线的ID转化为string,还有如何将曲面的ID转化为face collector?
4 A1 s9 e3 q' v+ K谢谢指导!!!!& Q* R# J5 d2 g2 W
代码如下(insect_curve 表示需要偏置曲线的ID,FP_surface表示曲面):
7 Y& D( e& f9 L UF_CURVE_ocf_data_p_t offset_data ;
; Q- L0 x% D; U/ B& g" t. e offset_data =(UF_CURVE_ocf_data_s*)malloc(sizeof(UF_CURVE_ocf_data_s));
! {3 T* p8 G/ [3 V) @% e' A memset(offset_data,0,sizeof(UF_CURVE_ocf_data_s));
6 P) a5 ^$ O9 {/ o9 m+ l //*******************************************************//3 l }$ N( j. M! c
UF_CURVE_ocf_string_data_p_t real_string_data;3 c5 T6 h8 F0 ^ n
real_string_data =(UF_CURVE_ocf_string_data_s*)malloc(sizeof(UF_CURVE_ocf_string_data_s));
- P3 e1 |# t" o; p( m0 M, K7 V. G memset(real_string_data,0,sizeof(UF_CURVE_ocf_string_data_s));
! u9 |& D7 N$ n4 G0 v8 K( G! D2 n real_string_data->string_tag=insect_curve; // (有问题) & M; g( S' T1 @$ M
/* Tag of the string to offset */ //??????- P4 e" B7 x }* M' C( }4 o
int real_offset_direction=1;
8 K" E8 [& \0 a0 {0 @8 I real_string_data->offset_direction=real_offset_direction;
+ ~9 ]/ l" e( C" K+ b9 A G /* Flag to indicate the offset direction.
; G: _ S) j! n5 s The direction can be either 1 or -1 */ //ok$ |# a2 v, i. t: U" F7 Q
int real_num_offset=1;( E/ ?3 w" _3 Y) f" w5 I
real_string_data->num_offsets=real_num_offset;% M% ?6 g$ O7 `( v9 V- O, R
/* Number of offsets to perform for the given string */ //ok7 g! {) w+ k# Z9 S. l
UF_CURVE_ocf_values_p_t real_offset_distances;9 L- `) C' h# Z: n7 x
real_offset_distances =(UF_CURVE_ocf_values_s *)malloc(sizeof(UF_CURVE_ocf_values_s));
# |$ q- B' F8 ]! Y) T( W0 b. E memset(real_offset_distances,0,sizeof(UF_CURVE_ocf_values_s));
9 J( f8 x$ ` P strcpy(real_offset_distances->string,"40.0");! n( K, H" C e: z+ y
(real_string_data->offset_distances)=real_offset_distances;
) M. x, {$ b+ x& j! u /* <len:num_offsets>An array that holds the offset values for
8 Q) W0 |6 L( S/ C each of the offset to perform for the given string */ //ok/ H7 A% ?& ?) H& `4 g
offset_data->string_data=real_string_data;
# g3 D. N0 f+ ]$ e s3 I /* <len:num_string_data> An array of strings to be offset and the data
! A- B0 f* Y3 B3 F6 }8 W. t associated with them, as described in above string data structure*/
/ }( Q6 K% y! k int real_num_string_data=1;+ e d5 w5 l0 V R2 W" A; }
offset_data->num_string_data=real_num_string_data; /* Size of the string array */
3 z' I. p3 F* F
7 R" G/ Q, W! V UF_CURVE_ocf_face_data_p_t real_face_data;. ^% U, |) i# q0 v# c
real_face_data =(UF_CURVE_ocf_face_data_s*)malloc(sizeof(UF_CURVE_ocf_face_data_s));# n" |, }$ d) ~
memset(real_face_data,0,sizeof(UF_CURVE_ocf_face_data_s));
) B) p/ a4 C: R* T) u+ i& {' \ real_face_data->face_tag=FP_surface;
: c( e# C% C& b offset_data->face_data=real_face_data; /* Face data */
' u" I8 E: \1 ~! k: g5 J. k+ I) p" c9 T% o2 D& v) A0 O3 v3 `
offset_data->cross_boundary_mode=UF_CURVE_OCF_CROSS_BOUNDARIES_NONE; /* boundary mode method*/ //OK7 H2 r, r' a; V! I ]
/ w+ V* b# M& r# v3 ? offset_data->offset_method=UF_CURVE_OCF_TANGENTIAL; /* 相切投影 */ //OK J" ?3 G( d4 p7 m. [
% v3 i& {3 `3 J1 k6 e1 p0 ] offset_data->trim_method=UF_CURVE_OCF_NO_EXTENSION; /* Trimming options for offset */ //OK6 e' o$ F( g* I* _. O& U7 l/ q8 G
4 a' e, N: U; n. d4 W offset_data->span_method=UF_CURVE_OCF_SPAN_QUILT; /* spanning options for offset */ //OK
" ]# `2 o" @. H2 r: G4 X) V- }4 y. r: {/ a' e3 {1 b1 [! _
double real_dist_tol=0.05;7 e9 u- `- N* i6 S9 E
offset_data->dist_tol=real_dist_tol; /* distance tolerance */ //OK7 [; q) ~4 t9 K: f
- Z( P7 k5 z' K6 {' ~! S
double real_ang_tol=0;
. I/ D& O0 r5 n `( l+ ?0 _9 l offset_data->ang_tol=real_ang_tol; /* angular tolerance */ //?
2 C$ Z& L* a2 N9 b
& |% n1 m& i1 f1 q4 w double real_string_tol=0;
5 j! L; K; U! Y. B) H offset_data->string_tol=real_string_tol; /* string tolerance */ //?
2 N0 ^, r/ P9 ? O& m3 \$ V5 i9 A7 L: n M+ X
tag_t *offset_curve=NULL;//tag_t * feature Output : offset curve on face feature //?
) c- U/ V0 i4 J% z( S UF_CURVE_create_ocf_feature (offset_data, offset_curve ); |
|