Creo二次开发--函数(6)--选择对象

ProSelect--用户交互选择对象的函数

选择对象的实例

ProSelection *sel;
int n_sel;

ProSelect ("datum", 1, NULL, NULL, NULL, NULL, &sels, &n_sels);
ProSelect ((char *)"feature", 1, NULL, NULL, NULL, NULL, &sel, &n_sel);
ProSelect ((char *)"curve", 1, NULL, NULL, NULL, NULL, &sel, &n_sel);
ProSelect ((char *)"point", 1, NULL, NULL, NULL, NULL, &sel, &n_sel) ;
ProSelect ((char *)"surface", 1, NULL, NULL, NULL, NULL, &sel, &n_sel);
ProSelect((char *)"prt_or_asm", 1, NULL, NULL, NULL, NULL, &p_sel, &n_sel);
ProSelect((char *)"csys",1,NULL,NULL,NULL,NULL,&win_sel,&sel_n);
ProSelect((char*)"dimension,ref_dim", 1, NULL, NULL, NULL, NULL, &sel, &n_sel);
ProSelect ((char*)"point,dtl_axis,datum,csys,edge,curve,surface", 1, NULL, NULL, NULL, NULL, &p_sel, &n_sel);
ProSelect ((char*)"feature,part", 1, NULL, NULL, NULL, NULL, &p_sel, &n_sel);
ProSelect ((char*)"dimension,ref_dim", 1, NULL, NULL, NULL, NULL,  &p_sel, &n_sel);
 ProSelect ((char*)"dwg_view", 1, NULL, NULL, NULL, NULL, &view_sel, &num_sel);
ProSelect ((char*)"any_note,draft_ent,dtl_symbol", 1, NULL, NULL, NULL, NULL, &p_sel, &n_sel);
ProSelect ((char*)"edge,curve,point,axis", 1, NULL, NULL, NULL, NULL,  &sel, &n_sel);
ProSelect ((char*)"dtl_symbol", 1, NULL, NULL, NULL, NULL, &p_sel, &n_sel);
ProSelect((char*)"point,axis,csys,edge_end", 1, NULL, NULL, NULL, NULL, &p_sel, &n_sel);
ProSelect((char*)"gtol", 1,NULL, NULL, NULL, NULL, &sel, &n_sel);

//下面是一组函数了。
/*============================================================================*\
 Function: ProTestSelectionDimFilter
 Purpose:       Filter function for dimension select
\*============================================================================*/
ProError ProTestSelectionDimFilter (
    ProSelection sel,
    ProAppData data)
{
    ProError err;
    ProDimension dim, base_dim;
    UserDimData  *sel_data = (UserDimData*)data;
    ProBoolean is_ordinate, type = sel_data->flag ;
    ProDrawing drw = (ProDrawing)sel_data->parent;
    err = ProSelectionModelitemGet (sel, &dim);
    err = ProDrawingDimIsOrdinate (drw, &dim, &is_ordinate, &base_dim);

    return (is_ordinate == type ? PRO_TK_NO_ERROR : PRO_TK_CONTINUE);
}
     ProSelFunctions sel_funcs;
    sel_funcs.pre_filter = (ProSelectionPreFilter)ProTestSelectionDimFilter;
    sel_funcs.post_filter =  NULL;
    sel_funcs.post_selact = NULL;
    sel_funcs.app_data = NULL;
    
    err = ProSelect((char *)"feature", 1, NULL,&sel_funcs , NULL, NULL, &sel_feat, &n_sel);

转载于:https://www.cnblogs.com/jh0262/archive/2013/01/29/2946785.html

你可能感兴趣的:(Creo二次开发--函数(6)--选择对象)