|
利用的是函数UF_CURVE_create_ocf_feature();
4 V! H l* i" p0 \ Y函数里面的参数有一个是表示偏置曲线的tag_t类型的参数,还有一个是表示曲面的tag_t类型的参数,但是我将曲线曲面的ID带入,怎么都得不到正确的结果。后来在文档中发现表示偏置曲线tag_t类型的参数必须是一个string,而曲面必须是一个face collector。那么如何将曲线的ID转化为string,还有如何将曲面的ID转化为face collector?
% z4 E$ ~& R& X6 H谢谢指导!!!!4 W3 [7 P' z( K* J1 n/ M! I
代码如下(insect_curve 表示需要偏置曲线的ID,FP_surface表示曲面):6 z5 k1 @7 j, ^/ v+ a
UF_CURVE_ocf_data_p_t offset_data ;
% R) s6 p9 y; z# j7 ]& ?. t offset_data =(UF_CURVE_ocf_data_s*)malloc(sizeof(UF_CURVE_ocf_data_s));2 F( Z* B- j8 S' K' B+ U
memset(offset_data,0,sizeof(UF_CURVE_ocf_data_s));
4 |; d6 A$ B$ U' Q2 V //*******************************************************//
9 c+ ? f7 I/ \9 h% v UF_CURVE_ocf_string_data_p_t real_string_data;- A+ p1 ?. ^4 v: B. ^
real_string_data =(UF_CURVE_ocf_string_data_s*)malloc(sizeof(UF_CURVE_ocf_string_data_s));3 A8 j+ M1 r# K) n
memset(real_string_data,0,sizeof(UF_CURVE_ocf_string_data_s));
/ O) ~- X3 A! I' M( |' ` real_string_data->string_tag=insect_curve; // (有问题) % E- V6 d$ [% E7 k
/* Tag of the string to offset */ //??????6 F3 t. z' b0 M5 B0 t v
int real_offset_direction=1;: b& u5 W* y( T1 o1 w" Y
real_string_data->offset_direction=real_offset_direction;
( A/ `/ \" }" ~* ?8 s1 v* l /* Flag to indicate the offset direction. G5 r' A) L9 Z1 @9 R1 e
The direction can be either 1 or -1 */ //ok6 Z9 g, G( L' q4 m$ F( o
int real_num_offset=1;. i4 D \1 O5 x8 I& v* c- h
real_string_data->num_offsets=real_num_offset;
M6 K; n5 {+ A# U7 N% y5 o /* Number of offsets to perform for the given string */ //ok
& {6 T6 A4 h5 J7 Y* r+ u0 a UF_CURVE_ocf_values_p_t real_offset_distances;
& f0 l+ @; L" g: ~. Y real_offset_distances =(UF_CURVE_ocf_values_s *)malloc(sizeof(UF_CURVE_ocf_values_s));
4 X! S7 g. D1 E% b5 N! L, ^ ? memset(real_offset_distances,0,sizeof(UF_CURVE_ocf_values_s));
8 s, n$ C3 i- }. P! { strcpy(real_offset_distances->string,"40.0");
$ u- d% }2 d, H8 l3 d. d (real_string_data->offset_distances)=real_offset_distances; & w9 `% r: `$ B9 Q8 W+ ^4 M
/* <len:num_offsets>An array that holds the offset values for* ^! ?' z7 w/ X/ T& R. h4 p
each of the offset to perform for the given string */ //ok2 u; R# S+ q* B' s- n% B" A8 I& ?) C
offset_data->string_data=real_string_data;( j; o6 _+ g% G& K! G7 x+ r9 W! D3 i
/* <len:num_string_data> An array of strings to be offset and the data ' k5 b9 i! G0 b2 [& ^6 m9 o7 g. a
associated with them, as described in above string data structure*/
! [- E4 C* s) E3 J, _/ B int real_num_string_data=1;
4 @/ G" u; ^9 s! u offset_data->num_string_data=real_num_string_data; /* Size of the string array */
. l# _/ C' V7 f: r" D3 p
# d8 @3 P. Z1 ~, J UF_CURVE_ocf_face_data_p_t real_face_data;
+ ^+ z- O4 F; N1 X, Q real_face_data =(UF_CURVE_ocf_face_data_s*)malloc(sizeof(UF_CURVE_ocf_face_data_s));
# L& Q/ O$ t2 s) E( c memset(real_face_data,0,sizeof(UF_CURVE_ocf_face_data_s));! y* i& E8 K3 b" w4 u8 ^. B5 O
real_face_data->face_tag=FP_surface;7 s7 j1 V! D) O2 Z9 k/ R3 F
offset_data->face_data=real_face_data; /* Face data */+ A' O4 I: Q* T: h9 ^$ U
6 o% u, }1 r; m
offset_data->cross_boundary_mode=UF_CURVE_OCF_CROSS_BOUNDARIES_NONE; /* boundary mode method*/ //OK+ w' }5 i3 E0 W( X& |0 ~! o# Z
0 r3 A5 T4 s1 D) ~( v; T2 ]- G! | offset_data->offset_method=UF_CURVE_OCF_TANGENTIAL; /* 相切投影 */ //OK$ `/ Q7 I7 i7 {( B) w
; r) F% z" z. ^8 k$ C6 m
offset_data->trim_method=UF_CURVE_OCF_NO_EXTENSION; /* Trimming options for offset */ //OK. H4 x" c$ n4 G1 B
! ~% D4 b. j: e2 w9 M offset_data->span_method=UF_CURVE_OCF_SPAN_QUILT; /* spanning options for offset */ //OK" R: N6 Q4 B, n
. K& W0 }, j/ b' O+ ?
double real_dist_tol=0.05;
! S4 K$ }" U- ? offset_data->dist_tol=real_dist_tol; /* distance tolerance */ //OK
/ A$ }0 x" m' W3 G" |, v0 |$ z! _! [. n9 J7 O# o
double real_ang_tol=0;6 A1 T7 i: \# `* o
offset_data->ang_tol=real_ang_tol; /* angular tolerance */ //?) N1 T j5 X& }- S* c @
% y$ ]; D4 I; M+ n7 m double real_string_tol=0;) t& s8 F+ I$ P; S% y
offset_data->string_tol=real_string_tol; /* string tolerance */ //?
, [7 l6 W Z. L* z( U0 C
% B8 Q3 Q/ \4 Z0 u$ h9 P' F- \ tag_t *offset_curve=NULL;//tag_t * feature Output : offset curve on face feature //?
6 Q A+ X; f7 Z) H% f; J8 s1 w( ] UF_CURVE_create_ocf_feature (offset_data, offset_curve ); |
|