📄 ug3dsection.c
字号:
status = ProSecerrorMsgGet ( *section_errors, error_count, error_message); ERROR_CHECK (" ProSecerrorMsgGet", "UserSecerrorPrint", status ); if ( status == PRO_TK_NO_ERROR ) { status = ProSecerrorItemGet ( *section_errors, error_count, &error_id); ERROR_CHECK (" ProSecerrorItemGet", "UserSecerrorPrint", status ); if ( status == PRO_TK_NO_ERROR ) { ProWstringToString (error_message_s, error_message); printf(" %s : Problem ID : %d \n", error_message_s, error_id ); } } } } status = ProSecerrorFree ( section_errors ); ERROR_CHECK (" ProSecerrorFree", "UserSecerrorPrint", status ); return status; }/*===============================================================*\ FUNCTION: UserSweepSectionAdd ProError UserSweepSectionAdd ( ProSection ); PURPOSE: Creates a 2D sketch for sweep section \*===============================================================*/ProError UserSweepSectionAdd ( ProSection section_here ){ Pro2dLinedef line; ProError status; int line_id[4]; int cline_id1, cline_id2; ProSelection *proj_ents; int proj_ids[2]; Pro2dLinedef *left_linedef, *btm_linedef; ProName section_name; ProWSecerror section_errors; int n_sec; ProMsg error_message; char error_message_s[100]; int i, error_id; status = ProSecerrorAlloc ( §ion_errors ); ERROR_CHECK (" ProSecerrorAlloc", "UserSweepSectionAdd", status ); { /* Adding Projection Entities => Specific to C/S in Sweep */ /*---------------------------------------------------------------*\ Get the projection entity handles as ProSelection structures. \*---------------------------------------------------------------*/ status = UserSelectProjectionEntities (&proj_ents); ERROR_CHECK (" UserSelectProjectionEntities", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; /*---------------------------------------------------------------*\ Project the reference edges onto the section. \*---------------------------------------------------------------*/ for (i = 0; i < 2; i++) { status = ProSelectionVerify ( proj_ents[i] ); ERROR_CHECK (" ProSelectionVerify", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; status = ProSectionEntityFromProjection ( section_here, proj_ents[i], &proj_ids[i]); ERROR_CHECK (" ProSectionEntityFromProjection", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; } status = ProSectionEntityGet ( section_here, proj_ids[0], (Pro2dEntdef**)&left_linedef); ERROR_CHECK (" ProSectionEntityGet", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; status = ProSectionEntityGet ( section_here, proj_ids[1], (Pro2dEntdef**)&btm_linedef); ERROR_CHECK (" ProSectionEntityGet", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; } line.type = PRO_2D_LINE; line.end1[0] = 0; line.end1[1] = 0; line.end2[0] = 100; line.end2[1] = 0; status = ProSectionEntityAdd ( section_here, (Pro2dEntdef*)&line, &line_id[0] ) ; ERROR_CHECK (" ProSectionEntityAdd", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; line.type = PRO_2D_LINE; line.end1[0] = 100; line.end1[1] = 0; line.end2[0] = 100; line.end2[1] = 100; status = ProSectionEntityAdd ( section_here, (Pro2dEntdef*)&line, &line_id[1] ) ; ERROR_CHECK (" ProSectionEntityAdd", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; line.type = PRO_2D_LINE; line.end1[0] = 100; line.end1[1] = 100; line.end2[0] = 0; line.end2[1] = 100; status = ProSectionEntityAdd ( section_here, (Pro2dEntdef*)&line, &line_id[2] ) ; ERROR_CHECK (" ProSectionEntityAdd", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; line.type = PRO_2D_LINE; line.end1[0] = 0; line.end1[1] = 100; line.end2[0] = 0; line.end2[1] = 0; status = ProSectionEntityAdd ( section_here, (Pro2dEntdef*)&line, &line_id[3] ) ; ERROR_CHECK (" ProSectionEntityAdd", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; { double epsilon; status = ProSectionEpsilonGet( section_here, &epsilon ); ERROR_CHECK (" ProSectionEpsilonGet", "UserSweepSectionAdd", status ); printf ("The current epsilon is %f\n", epsilon ); } status = ProSectionEpsilonSet( section_here, 0.1 ); ERROR_CHECK (" ProSectionEpsilonSet", "UserSweepSectionAdd", status ); if (status != PRO_TK_NO_ERROR) return status; status = ProSectionAutodim ( section_here, §ion_errors ); ERROR_CHECK (" ProSectionAutodim", "UserSweepSectionAdd", status ); if ( status != PRO_TK_NO_ERROR ) { UserSecerrorPrint ( §ion_errors ); return status; } status = ProSectionRegenerate ( section_here, §ion_errors ); ERROR_CHECK (" ProSectionRegenerate", "UserSweepSectionAdd", status ); if ( status != PRO_TK_NO_ERROR ) { UserSecerrorPrint ( §ion_errors ); return status; } return ( status ); }/*===============================================================*\ FUNCTION: UserSweepSpineAdd ProError UserSweepSpineAdd ( ProSection, ProSelection * ); PURPOSE: Creates a 3D trajectory for sweep section \*===============================================================*/ProError UserSweepSpineAdd (ProSection section_here, ProSelection *sketch_refs ){ ProSelection *proj_ents; int status, i, num_errors, err_counter, proj_ids[2]; int ctr_line_id, rt_line_id, lt_line_id, top_line_id, btm_line_id; int upper_arc_id, lower_arc_id, ent_id[1], c_ent_id[2], proj_ent_id[2]; int ll_dim_id, tl_dim_id, ua_dim_id, la_dim_id, cl_dim_id, proj_dim_id[2]; ProWSecerror sec_errors; Pro2dLinedef line; Pro2dClinedef c_line; Pro2dLinedef *left_linedef, *btm_linedef; ProSectionPointType pt_type[1], proj_pt_type[2]; Pro2dArcdef arc; Pro2dPnt place_pnt; ProMsg wmsg; char msg[PRO_PATH_SIZE]; double offsets[2]; Matrix_data matrix_data; int row, column; /* initializing the matrices */ for ( row = 0; row < 4; row++ ) { for ( column = 0 ; column < 4; column++ ) { matrix_data.sec_trf[row][column] = 0.0; matrix_data.sk_mtrx[row][column] = 0.0; } } /*---------------------------------------------------------------*\ Get the projection entity handles as ProSelection structures. \*---------------------------------------------------------------*/ status = UserSelectProjectionEntities (&proj_ents); ERROR_CHECK (" UserSelectProjectionEntities", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; /*---------------------------------------------------------------*\ Project the reference edges onto the section. \*---------------------------------------------------------------*/ for (i = 0; i < 2; i++) { status = ProSelectionVerify ( proj_ents[i] ); ERROR_CHECK (" ProSelectionVerify", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; status = ProSectionEntityFromProjection ( section_here, proj_ents[i], &proj_ids[i]); ERROR_CHECK (" ProSectionEntityFromProjection", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; } /*---------------------------------------------------------------*\ Create the section coordinate system from the edges. Get the transformation matrix between the sketch plane coordinate system and the section coordinate system. \*---------------------------------------------------------------*/ status = ProSectionEntityGet ( section_here, proj_ids[0], (Pro2dEntdef**)&btm_linedef); ERROR_CHECK (" ProSectionEntityGet", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; for (i = 0; i < 2; i++) { matrix_data.x_axis[0][i] = btm_linedef->end1[i]; matrix_data.x_axis[1][i] = btm_linedef->end2[i]; matrix_data.x_axis[i][2] = 0.0; } status = ProSectionEntityGet ( section_here, proj_ids[1], (Pro2dEntdef**)&left_linedef); ERROR_CHECK (" ProSectionEntityGet", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; for (i = 0; i < 2; i++) { matrix_data.y_axis[0][i] = left_linedef->end1[i]; matrix_data.y_axis[1][i] = left_linedef->end2[i]; matrix_data.y_axis[i][2] = 0.0; } status = ProSectionLocationGet ( section_here, matrix_data.sk_mtrx); ERROR_CHECK (" ProSectionLocationGet", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; status = ProSelectionCopy (sketch_refs[0], &(matrix_data.sk_plane)); ERROR_CHECK (" ProSelectionCopy", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; status = UserCreateTrfMatrix (&matrix_data); ERROR_CHECK (" UserCreateTrfMatrix", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; /*---------------------------------------------------------------*\ Get the offset values from the projection entities. \*---------------------------------------------------------------*/ status = UserSelectOffsetDistances (offsets); ERROR_CHECK (" UserSelectOffsetDistances", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; printf("Offset Distances in main are offset[0] = %f : offset[1] = %f\n", offsets[0], offsets[1]); /*---------------------------------------------------------------*\ Add the left vertical line. \*---------------------------------------------------------------*/ line.type = PRO_2D_LINE; line.end1[0] = offsets[1]; line.end1[1] = offsets[0]; line.end2[0] = offsets[1]; line.end2[1] = offsets[0] + 50.0; ProUtil2DPointTrans (matrix_data.sec_trf, line.end1, line.end1); ProUtil2DPointTrans (matrix_data.sec_trf, line.end2, line.end2); status = ProSectionEntityAdd ( section_here, (Pro2dEntdef*)&line, <_line_id); ERROR_CHECK (" ProSectionEntityAdd", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; /*---------------------------------------------------------------*\ Solve and regenerate the section. \*---------------------------------------------------------------*/ status = ProSecerrorAlloc (&sec_errors); ERROR_CHECK (" ProSecerrorAlloc", "UserSweepSpineAdd", status ); status = ProSectionEpsilonSet( section_here, 0.1 ); ERROR_CHECK (" ProSectionEpsilonSet", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) return status; status = ProSectionAutodim ( section_here, &sec_errors); ERROR_CHECK (" ProSectionAutodim", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) { UserSecerrorPrint ( &sec_errors ); return status; } status = ProSectionRegenerate ( section_here, &sec_errors); ERROR_CHECK (" ProSectionRegenerate", "UserSweepSpineAdd", status ); if (status != PRO_TK_NO_ERROR) { UserSecerrorPrint ( &sec_errors ); return status; } status = ProSelectionFree (&(matrix_data.sk_plane)); ERROR_CHECK (" ProSelectionFree", "UserSweepSpineAdd", status ); return (status);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -