在BLOCK上创建一个简单孔

	UF_FEATURE_SIGN sign = UF_NULLSIGN;
    double block_orig[3] = { -25.0,-25.0,0.0 };
    char* block_len[3] = { "50","50","30" };
    tag_t blk_obj;
    UF_MODL_create_block1(sign, block_orig, block_len, &blk_obj);

    tag_t body_obj_id;
    UF_MODL_ask_feat_body(blk_obj, &body_obj_id);//获取特征所在体

    uf_list_p_t face_list;
    UF_MODL_create_list(&face_list);
    UF_MODL_ask_feat_faces(blk_obj, &face_list);

    int facecount;
    UF_MODL_ask_list_count(face_list, &facecount);

    tag_t placement_face = NULL_TAG;
    tag_t thru_face= NULL_TAG;

    for (int i = 0; i < facecount; i++)
    {
        tag_t face_obj_id;
        UF_MODL_ask_list_item(face_list, i, &face_obj_id);
        
        int type = 0;
        double point[3] = { 0 };
        double dir[3];
        double box[6];
        double radius;
        double rad_data;
        int norm_dir;
        UF_MODL_ask_face_data(face_obj_id, &type, point, dir, box, &radius, &rad_data, &norm_dir);

        if (type == 22)
        {
            if ((dir[0] == 0.0) && (dir[1] == 0.0) && (dir[2] == 1.0))
            {               
                placement_face = face_obj_id;
            }
        }
    }
    UF_OBJ_set_color(placement_face, 100);

    double location[3] = { 0, 0, 30 };
    double direction1[3] = { 0, 0, -1 };
    char* diame = "20";
    char* depth = "10";
    char* angle = "120";
    tag_t hole_tag;

    UF_MODL_create_simple_hole(location, direction1, diame, depth, angle,placement_face, thru_face, &hole_tag);

open c UF_MODL_create_simple_hole 识别放置平面 UF_MODL_ask_face_data-LMLPHP

04-12 08:00