封装函数获取体的最大4个角

struct MyStruct4
{
    Point3d p1;
    Point3d p2;
    Point3d p3;
    Point3d p4;
};

vector<MyStruct4>parts_bnd;

static void getpointlist(vector<MyStruct4>& points)
{
    char Cue[] = "选择实体";
    char Title[] = "选择要处理的实体";
    int Scope = UF_UI_SEL_SCOPE_NO_CHANGE;
    int Response;
    tag_t* Object;
    int count = 0;    
    UF_UI_select_with_class_dialog(Cue, Title, Scope, init_proc_body, NULL, &Response, &count, &Object);
    if (count)
    {
        MyStruct4 prt;
        for (size_t i = 0; i < count; i++)
        {
            tag_t csys_tag0 = NULL_TAG;
            tag_t matrix_id0 = NULL_TAG;
            double csys_origin0[3];            
            UF_CSYS_ask_wcs(&csys_tag0);
            UF_CSYS_ask_csys_info(csys_tag0, &matrix_id0, csys_origin0);
            double min_corner0[3], directions0[3][3], distances0[3];
            UF_MODL_ask_bounding_box_exact(Object[i], csys_tag0, min_corner0, directions0, distances0);
            Point3d poins0(min_corner0[0], min_corner0[1], min_corner0[2] + distances0[2]+1);            
            Point3d poins1(min_corner0[0], min_corner0[1] + distances0[1], min_corner0[2] + distances0[2]+1);            
            Point3d poins2(min_corner0[0] + distances0[0], min_corner0[1] + distances0[1], min_corner0[2] + distances0[2]+1);            
            Point3d poins3(min_corner0[0] + distances0[0], min_corner0[1], min_corner0[2] + distances0[2]+1);
            prt.p1 = poins0;
            prt.p2 = poins1;
            prt.p3 = poins2;
            prt.p4 = poins3;
            parts_bnd.push_back(prt);
            UF_DISP_set_highlight(Object[i],0);
        }
    }
}

 

posted @ 2020-09-22 21:50  老婆饼里有老婆  阅读(196)  评论(0编辑  收藏  举报