|
利用的是函数UF_CURVE_create_ocf_feature();# N4 y: H+ k# ^+ R) Z. M$ L7 l' N
函数里面的参数有一个是表示偏置曲线的tag_t类型的参数,还有一个是表示曲面的tag_t类型的参数,但是我将曲线曲面的ID带入,怎么都得不到正确的结果。后来在文档中发现表示偏置曲线tag_t类型的参数必须是一个string,而曲面必须是一个face collector。那么如何将曲线的ID转化为string,还有如何将曲面的ID转化为face collector?$ N. n0 J6 V( w7 T
谢谢指导!!!!2 e2 v2 F2 p) s, I4 w$ u
代码如下(insect_curve 表示需要偏置曲线的ID,FP_surface表示曲面):
; f/ \! z3 _3 u3 q6 | UF_CURVE_ocf_data_p_t offset_data ;$ W/ [2 [6 d& s2 [8 C0 b( d
offset_data =(UF_CURVE_ocf_data_s*)malloc(sizeof(UF_CURVE_ocf_data_s));
# U+ ~ `: \, M/ X memset(offset_data,0,sizeof(UF_CURVE_ocf_data_s));, E# n7 h9 G# i" r, G. i6 `* W
//*******************************************************//
8 Y. u3 e0 D; z' T UF_CURVE_ocf_string_data_p_t real_string_data;
# h5 x4 A, c2 M" n- z5 I6 l( T real_string_data =(UF_CURVE_ocf_string_data_s*)malloc(sizeof(UF_CURVE_ocf_string_data_s));
9 l/ v5 ]" i. T memset(real_string_data,0,sizeof(UF_CURVE_ocf_string_data_s));
( c7 H( L/ R+ k( s real_string_data->string_tag=insect_curve; // (有问题) ' Z) t1 D" K# M7 K
/* Tag of the string to offset */ //??????
9 Z7 D8 A: s) H4 W1 C! I int real_offset_direction=1;# T- a" S! R# x
real_string_data->offset_direction=real_offset_direction;
# c+ H Y* l0 ]8 l /* Flag to indicate the offset direction. 0 m5 t- B; u( H8 `5 H
The direction can be either 1 or -1 */ //ok& W* [% {& }7 Q# Q0 t& t- U
int real_num_offset=1;
, h) v, f8 `8 I real_string_data->num_offsets=real_num_offset;
8 f) |4 I! e& B8 r7 l# D /* Number of offsets to perform for the given string */ //ok
4 s8 x: i0 h; Q7 K. ?1 i9 s UF_CURVE_ocf_values_p_t real_offset_distances;2 n; H; X6 D+ k' d
real_offset_distances =(UF_CURVE_ocf_values_s *)malloc(sizeof(UF_CURVE_ocf_values_s));2 F( F/ h6 n3 E: V6 u$ n8 H/ L' L
memset(real_offset_distances,0,sizeof(UF_CURVE_ocf_values_s));
- R" \; p. g: \; ]! R strcpy(real_offset_distances->string,"40.0");
; r' p- z& W; N6 H1 l (real_string_data->offset_distances)=real_offset_distances;
: w6 Z- u! E7 V+ a( E7 T /* <len:num_offsets>An array that holds the offset values for8 t! ~0 ~) w- J. Y" U$ {
each of the offset to perform for the given string */ //ok
2 W( y/ y' b9 o: w! H offset_data->string_data=real_string_data;
! [2 @, t: n; K0 C: ~ /* <len:num_string_data> An array of strings to be offset and the data
1 b& S2 x) P" {0 P1 f9 ^7 {% y associated with them, as described in above string data structure*/. `$ {- P5 G% R' \' c
int real_num_string_data=1;" c: l; k$ M+ j
offset_data->num_string_data=real_num_string_data; /* Size of the string array */6 O7 L* l/ F% x3 s
0 q) O6 T- u: E+ u4 v/ [9 Z# d/ | UF_CURVE_ocf_face_data_p_t real_face_data;6 V8 j9 p" F+ J7 c
real_face_data =(UF_CURVE_ocf_face_data_s*)malloc(sizeof(UF_CURVE_ocf_face_data_s));
) Q! T& v2 E: S2 d memset(real_face_data,0,sizeof(UF_CURVE_ocf_face_data_s));% n7 D: [- m( B ^# N, n& l
real_face_data->face_tag=FP_surface;
9 j+ K1 @* r% z+ }5 h offset_data->face_data=real_face_data; /* Face data */0 {# R# `* j. z3 f
. v; o9 M! x" A- x
offset_data->cross_boundary_mode=UF_CURVE_OCF_CROSS_BOUNDARIES_NONE; /* boundary mode method*/ //OK
7 p% T ~4 o( w6 G+ @+ K. H, p% ~- u& e6 H/ s x t
offset_data->offset_method=UF_CURVE_OCF_TANGENTIAL; /* 相切投影 */ //OK, b( V, e/ \% |1 T) x2 v
+ D/ R" C! s4 J6 R9 s! g; R6 g offset_data->trim_method=UF_CURVE_OCF_NO_EXTENSION; /* Trimming options for offset */ //OK2 h# ]5 {: [& l/ P" l* o4 h
$ i/ n. e. u+ D/ b
offset_data->span_method=UF_CURVE_OCF_SPAN_QUILT; /* spanning options for offset */ //OK
1 R$ s; q' i5 z1 A7 w, {
4 [9 J' X2 ?3 O4 a double real_dist_tol=0.05;. s4 C0 T; Y5 @, v5 {
offset_data->dist_tol=real_dist_tol; /* distance tolerance */ //OK4 f1 s5 [" U S* ]
- H1 D8 f+ }" T3 u3 r double real_ang_tol=0;: ]) o0 S. A) ?. x: n0 H9 U
offset_data->ang_tol=real_ang_tol; /* angular tolerance */ //?
+ }- w+ f. F# m) `. {9 L, u7 |. y( K, e2 m% A! ~
double real_string_tol=0;
3 @7 N8 }; \% i* |8 B( Q8 M8 b offset_data->string_tol=real_string_tol; /* string tolerance */ //?
; Y1 U; o, o; `) ]- P/ p8 f& [( W5 W$ [, U
3 {3 _# h' x" H7 d tag_t *offset_curve=NULL;//tag_t * feature Output : offset curve on face feature //?' L* \$ Y3 I) [) K: ?9 h
UF_CURVE_create_ocf_feature (offset_data, offset_curve ); |
|